Björn Larsson wrote: > Given this unexpected behaviour, one could almost see it as a bug.
This isn't a suddenly noticed new bug. That code has worked like that since the sleep function was committed twenty-two years ago or for five years since the release of PHP 7 and the weak/strict RFC continued the "if you don't want float -> int conversions, use strict mode" choice. There are quite a few functions in PHP that take int parameters, that have this behaviour. These could all be 'fixed' by people using strict mode, and you could make a good argument for making strict mode the default, but it's probably a bit late in the 8.0 release cycle for that, and it _might_ be a little contentious. I agree that the PHP standard library is not as good as it could be, but tweaking it piece-by-piece is not a good way of fixing it. Doing it like that would lead to subtle BC breaks that are not obvious. G.P.B. wrote: > I'd rather see the failure condition changed to reject 0 or add a > E_NOTICE/E_WARNING if 0 is passed as this has questionable semantics. sleep(0) is a useful thing to do in some circumstances. It has the same effect as Thread.yield() in Java. Or in English, it allows a process to say "Hello OS scheduler, I don't want to sleep right now, but if there are any other threads that are waiting for their turn, now is a great time to suspend my execution, as I'm not in the middle of anything, otherwise I'll keep processing." Again, yes we need a better way of evolving the core libraries. But tweaking it on a function by function basis is not a good way of doing that. cheers Dan Ack -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php