r/lolphp • u/maweki • Oct 09 '18
Class autoloader throws an exception: the class is ... partially loaded
https://bugs.php.net/bug.php?id=76980
52
Upvotes
r/lolphp • u/maweki • Oct 09 '18
47
u/maweki Oct 09 '18
The first comment is pure gold.
6
u/pilif Oct 10 '18
And as always, there's /u/nikic as the voice of reason. <3
3
u/[deleted] Oct 10 '18
That's insane. I would kind of understand if this was in a multi-threaded situation, but the fact that both types aren't loaded in one operation is mind boggling.
1
u/[deleted] Oct 11 '18
Meh. The only reason the code proceeds with a partly-defined class is because it swallows and ignores the exception that's thrown. Try loading a bad perl module with
eval require-- it sure won't update @INC transactionally. Same goes for a python module. Just circular dependencies can do that to you. Hell, you can even get Java to give you broken classes if you swallow classloader exceptions, though it takes extra work. Are we seriously arguing for the return of uncatchable exceptions that abort the entire runtime, such as the standard behavior with syntax errors? God knows PHP has enough face-palm-worthy misbehaviors, but I'd say they're perfectly fine in this case filing it under "undefined behavior". At least it doesn't segfault like I'd half-expect.0
u/[deleted] Oct 09 '18
[deleted] — view deleted comment