This creates problems for opcode caches since the classes are all
precompiled and usually optimized to the point where the opcodes that
loads them are NOP'ed away and you just have the full class table cached
in memory for each op_array.  Walking through that class table on every
request and looking for these magic methods to call would be quite
annoying, especially since most of them wouldn't have such a method to
begin with.

-Rasmus


As a class is added to the table (on first execute of the opcodes) it can check at that point if the magic method exists, and put it in a separate compact list to call for every request. Walking all classes repeatedly is thus avoided.

However, a remaining problem is the user no longer controls when exactly are his classes initialized, and in what concrete order. We have the potential for race conditions, where classes B, and C rely on initialized class A, or on some other initialization routine called in userland, which has not been executed yet, producing "sometimes broken" code that's hard to debug.

Stan Vass


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to