Script failure after upgrade to PHP 5.2.1
Posted by: miv3
Posted on: 2007-02-24 12:58:00
Hey people :)
I'm having some trouble with a little CMS system I have written, which worked perfectly before the upgrade to PHP 5.2.1 on DH. I cannot switch back to PHP4, as I use PHP5's object-oriented features.
I get the following notices and errors:
Notice: Indirect modification of overloaded property Blog::$posts has no effect in /path/class/Blog.class.php on line 121
Notice: Undefined offset: 0 in /path/class/Blog.class.php on line 122
Fatal error: Call to a member function get_post() on a non-object in /path/class/Blog.class.php on line 122
By searching on Google, I have found out that the magic method __get() doesn't return properties by reference anymore, so that's probably why I get this error message. The problem is that I have used this property overloading feature quite extensively, and I don't know how to fix my problems. These are the __get() and __set() methods in my class:
private function __get($name)
{
if (array_key_exists($name, $this->data))
{
return $this->data[$name];
}
return null;
}
private function __set($name, $value)
{
if (isset($this->data[$name]))
{
$this->data[$name] = $value;
}
}
One of the sites in question is http://mdev.dk , my techblog, although I don't really feel that technically enlightened right now. ;)
I hope somebody out there can help me. :)
Cheers from Denmark