Matthew Weier O'Phinney wrote:

I encountered this issue with Zend_View, and fixed it for the latest
release.

The only solution that works with <= 5.2.0 is to use public properties:

    public function __set($key, $value)
    {
        if ('_' != substr($key, 0, 1)) {
            $this->$key = $value;
        } else {
            throw new Exception('Cannot set protected/private class members');
        }
    }


Unfortunately, I don't see this as a potential solution as Zend_Session is taking full advantage of what php offered in 5.1 series, and that was to be able to provide a magic interface to imitate the StdClass behavior to to funnel requests into a specific container unit.. In our case, they end up in $_SESSION[$namespace][$name] = $value; where $name/$value came from __set().

Getting them to the class would serve little purpose... Now, if destructors worked better and less random, this might be a solution as the destructor could just reflect, clean up and store. But I don't see that as a viable option.

When it comes to imitating the StdClass with magic methods as it relates to storing arrays, PHP 5.2.0 is simply broken.

I don't get mad, b/c honestly, they do put out around 4 Release candidates, and I suppose I (we) should be testing those to the best of my (our) ability to avoid these types of issues. After all PHP is our playground.

Reply via email to