Re: Re: [Patches]#36944, #54556, #55211(and svn karma applying)

From: Date: Tue, 26 Jul 2011 11:31:07 +0000
Subject: Re: Re: [Patches]#36944, #54556, #55211(and svn karma applying)
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-54209@lists.php.net to get a copy of this message
Em Tue, 26 Jul 2011 12:14:15 +0100, Laruence <laruence@php.net> escreveu:
2011/7/26 Gustavo Lopes <glopes@nebm.ist.utl.pt>:
Em Tue, 26 Jul 2011 06:42:50 +0100, Laruence <laruence@php.net> escreveu:
2011/7/25 Laruence <laruence@php.net>:
#54556 array access to empty var does not trigger a notice https://bugs.php.net/bug.php?id=54556
Won't this be affected? <?php $foo[] = 'bar';
no, this situation won't be affected
Ah, if this is only for read situations, a notice seems appropriate.
#55128 SplFixedArray::fromArray() does not use extended class
This doesn't look like a good idea. The constructor is not called (and in general can't be, since we can't know how the subclass constructor looks like), so the new object can be in an illegal state.
After much thought, I think there maybe no reason for fixedarray extended class to define it's own constructor, since we provide fixedarrary::__construct and fromArray already, and extended class should only get an instance through calling them. so I think we can make fixedarray::__construct final to make this feature works.
I disagree. Besides being a BC break, there's no good reason to make the constructor final and it has the disadvantage of severely limiting the subclasses. Instead of using LSB, I think a better option would be to provided a protected final instance method that would do this special form of initialization from an array. Subclasses could then write their own static method (possibly with the same name) for initializing from an array or even accept an array as a constructor argument. This is a bit more work and less magic than LSB, but much more versatile. -- Gustavo Lopes

« previous php.internals (#54209) next »