In order to fire the shutter when any of the pre-STM variants of the EF 50mm f/1.8 is out of focus, the switch on the lens must be set to M (manual) rather than AF (auto focus). Attempting to manually focus those lenses with AF engaged can damage the focusing motor and mechanism. If the motor is still trying to engage when the lens is set to M it needs to be serviced.
There are two variants of the Canon 18-135 lens. The older EF 18-135mm f/3.5-5.6 IS behaves the same as the 50mm f/1.8 series with regard to focus. You should not attempt to manually focus the lens when the switch is set to AF. For the newer EF 18-135mm f/2.5-5.6 IS STM, Full Time Manual focusing (manual focusing when the switch is set to AF) is available, but only after AF completes in One Shot mode with the shutter release remaining half-pressed. I was under the impression this only worked with the newer T4i and newer bodies, but based on your experience described in your question the T3i is compatible with this feature as well.
This is a very late edit, but a recent experience I had might suggest a possibility for anyone else with this problem:
If the lens has been opened up (to be internally cleaned, for instance) it's extremely easy to misalign the external AF/MF switch with the actual switch underneath it on the lens' PC board when putting it back together. If this occurs, the outer switch can break the plastic tab off the actual switch and then moving the external AF/MF switch does nothing. Whichever position the actual switch is in (it can be moved with a narrow probe when the lens is disassembled) is what the lens is set to regardless of the position of the external switch.
I've experienced this with the EF 85mm f/1.8, but a number of Canon's other lower priced non-L primes are also made in the same way. My solution is to leave the internal switch set to 'AF'. Since I usually have back-button AF set up and half-pressing the shutter button only activates metering without activating AF, I need to only release the 'AF-ON' button to be able to manually focus the EF 85mm f/1.8 with ring-type USM.
Unfortunately, the EF 50mm f/1.8 does not have ring-type USM and the manual focus ring should not be moved when the switch is set to 'AF'. I don't know if the external/internal switches are connected the same way with the EF 50mm f/1.8, but the EF 50mm f/1.4 is constructed the same way the EF 85mm f/1.8 is (as well as the EF 100mm f/2, among others).