Magic getter bug tickled by Moodle
| From: | Rasmus Lerdorf | Date: | Sat, 31 Jan 2015 05:04:30 +0000 |
| Subject: | Magic getter bug tickled by Moodle | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-81467@lists.php.net to get a copy of this message | ||
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)
-Rasmus
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc