This example may look scrupulous but seems typical.
While this isn’t an issue of PHP (the language) itself, it’s IMO typical for the actual PHP code existing. It does work somehow, despite the fact that it’s totally agnostic of the basics it claims to be based upon. So it may fail any given, unforeseeable, moment, when any of the implicitly assumed side-conditions change.
P.P.S.: I don’t do PHP, I just came across when patching https://github.com/mro/Shaarli a bit.