I don't believe thats how PHP works (atleast not anymore). When the request is made the code is first compiled to opcodes and only after that's done the opcodes are run. In most production environments these opcodes are even cached so even if you delete the project it will run.

In any case you would have to hit some few milisecond window in this opcache generation to break single request but even that might be unlikely thanks to how filesystems read files?

In that example, I'm pretty sure that the 'require' line is compiled to opcodes, but not executed, until that line is reached. Supporting evidence: https://stackoverflow.com/questions/37880749/when-is-a-php-i...

So if there's a 10 second gap between the start of execution and the 'require' line being reached and evaluated, then any incompatible changes to the file being required within that 10 seconds will cause an error.

That actually makes sense because the codepath could be huge with huge surfaces of unused code.

With OpCache this could be solved so i guess lessin for me - deploy like this with opcache on.

Well, now you just have to manage cache invalidation. Piece of cake!

I kid, I kid, but seriously, now you have a different set of issues.