I have bought a Sony Xperia Z3 Compact, D5803 model, with Android 5.1.1. build number 23.4.A.1.200, off Ebay. Somehow the flashlight LED came on. I could not turn it off by clicking the flashlight icon on the pull-down menu.
Same thing with taking a picture. I took a picture to see what happens with auto flash. I aimed the camera in a dark corner and the flashlight turned on. And it stayed on, it would not torn off, even when I toggled the flashlight icon. It is super annoying.