Re: A quick consensus on magic method idea

From: Date: Mon, 07 Feb 2011 15:39:26 +0000
Subject: Re: A quick consensus on magic method idea
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-51431@lists.php.net to get a copy of this message
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

« previous php.internals (#51431) next »