On Mon, 25 Apr 2011 12:32:04 +0100, Hannes Magnusson
<hannes.magnus...@gmail.com> wrote:
2011/4/4 Gustavo André dos Santos Lopes <cataphr...@php.net>:
cataphract Mon, 04 Apr 2011 02:50:27 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=309929
Log:
- Fixed bug #54384 (Dual iterators, GlobIterator, SplFileObject and
SplTempFileObject crash when user-space classes don't call the paren
constructor).
Bug: http://bugs.php.net/54384 (Assigned) Several SPL classes crash
when parent constructor is not called
Uhm.. Whats the dealio with that new method?
Is that really the best way to fix it?
The "best way" is always a weighted combination of several factors (BC
impact, maintainability, consistency, effort, performance, etc.), and
those weights are subjective. In case of this type of bug (userspace
subclass doesn't call native super constructor), I used a constructor
wrapper in trunk, which is, I think the best option because it executes
the check only once and as soon as currently possible (when the object is
created).
However, this represents a BC break because userspace classes that used to
call the super constructor at a later time will no longer work. So I went
with another solution for 5.3. The dual iterators got a check on each
object fetch from the store because that technique was already being used
in spl_iterators.c. However, this technique is tedious and error prone
because it requires a change in every instance method, so in
spl_directory.c I used a centralized the check in the get_method handler;
this technique was already used in SPL the difference is it would emit an
error instead of causing an exception to be thrown.
--
Gustavo Lopes
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php