Re: Magic getter bug tickled by Moodle
| From: | Michael Wallner | Date: | Sat, 31 Jan 2015 07:13:16 +0000 |
| Subject: | Re: Magic getter bug tickled by Moodle | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81469@lists.php.net to get a copy of this message | ||
On 31 Jan 2015 06:04, "Rasmus Lerdorf" <rasmus@lerdorf.com> wrote:
>
> There is something weird going on with PHP7 and the moodle_page class
> and all its magic methods. It dies with a:
>
> /var/www/moodle/blocks/navigation/block_navigation.php(223) : Notice -
> Undefined property: moodle_page::$navigation
> /var/www/moodle/blocks/navigation/block_navigation.php(223) : Fatal
> error - __clone method called on non-object
>
> That code is:
>
> 222 $this->page->navigation->initialise();
> 223 return clone($this->page->navigation);
>
> See:
>
https://github.com/moodle/moodle/blob/master/blocks/navigation/block_navigation.php#L222-L223
>
> $this->page_navigation is created on that initial call through the
> wonders of this magic:
>
>
> https://github.com/moodle/moodle/blob/master/lib/pagelib.php#L757-L772
>
> Which somehow leads us to read 8 bytes in a free'ed block:
>
> https://gist.github.com/anonymous/f9d1f53b1205d29d86cc
>
> but I am not having much luck dwindling it down to a simpler reproduce
> case. If you know this code or have a couple of hours to spare, could
> you see if you could reduce it to something more manageable for us?
>
> (and yes, same code is fine in 5.6)
>
Here's a similar bug, too: https://bugs.php.net/bug.php?id=68933&edit=1