3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Container { public function getObject() { $this->object = new StringableObject(); return $this->object; } // This destructor is required to exist to trigger the segfault public function __destruct() { } } class StringableObject { public function __toString() { $this->test = $this; return 'test123'; } } $container = new Container(); $object = $container->getObject(); // Any kind of function which triggers a 'to string' object conversion // Casting $object with (string) will circumvent the problem echo trim($object); // Another call is required to corrupt heap echo trim('test');
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property Container::$object is deprecated in /in/MbW5b on line 6 Deprecated: Creation of dynamic property StringableObject::$test is deprecated in /in/MbW5b on line 21 test123test

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
40.26 ms | 401 KiB | 8 Q