Matthew Weier O'Phinney wrote:

No. 5.2.0 introduced a BC break in property overloading with previous
PHP versions, as well as shipped a broken version of ArrayObject. The

Right.


5.2.1 fixes things somewhat, in that ArrayObject now works. However, you
still cannot overload to arrays unless they are public properties, and
even then, you still cannot create arrays using a notation such as:

    $o->foo[] = 23; // Will not create an array

From what I am witnessing, 5.2.1 works perfectly, but only when you force the return by reference on __get().

Essentially this:

  public function __get($name) {}

becomes

  public function & __get($name) {}

This is the notation that should be used moving forward for all implementations of classes that expect to emulate the stdClass when it comes to storage of arrays and objects.

Keep in mind, Zend_Session does not save to a public property since the only place it has as an option to save to is the $_SESSION superglobal.

This works b/c it forces the 5.2.*+ series (not including 5.2.0) to return by reference [since __get is called implicitly by __set($name,$value) on complex datatypes as $name]. This ALSO works for the 5.1.* series since returning by reference is essentially redundant since that is what it was doing anyway.

Thus, 5.2.0 is the only bad egg.

See the tests here:
http://framework.zend.com/issues/browse/ZF-1743

-ralph


Reply via email to