A little bit of context. The voltage supply is 5V. Current range must be from 0mA to 30mA or so. Load will be an LED but for now I'm just connecting the collector to Vcc and measuring current with an amp meter. The transistor I'm using is BC337 and the opamp is OP07 connected to 5V and 0V. Vset is a PWM filtered with an RC circuit. Rset is 100 ohms.
Now for the part that doesn't work. For voltages above 1V, 20% of Vcc, in the input Vset, the circuit behaves as expected. That is, I get a 10mA current at 1V and I get Vset/Rset current for every Vset until the transistor enters saturation around 30mA.
For voltages under that, the opamp does something I'd never seen before, it operates neither in linear nor saturation region. As I start lowering the voltage on Vset, both inputs separate, the inverting input lowers less and less until it gets stuck at around 500mV. So the final result is that I have 0V in the non inverting input, 500mV in the inverting input and thus 5mA through Rset. This is obviously not linear region because there is no virtual short circuit. However, the voltage on the base isn't Vcc, if it were Vbe would be huge and I'd get a bigger current. Instead, it gets stuck at around 1V.
How can the opamp do this? What sort of operation is this and how do I stop it?