3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ObjectWithReferences { protected $var1; protected $var2; public function __construct() { $this->var1 = new StdClass(); $this->var2 = $this->var1; } } class WrapperObject implements Serializable { private $obj; public function __construct($obj) { $this->obj = $obj; } public function getObject() { return $this->obj; } public function serialize() { global $repo; $obj = new \StdClass; $repo[] = $obj; unserialize(serialize($obj)); // this fucks up things return serialize($this->obj); } public function unserialize($serialized) { $this->obj = unserialize($serialized); } } $repo = array(); $wrapper = new WrapperObject(new ObjectWithReferences()); var_dump($wrapper->getObject()); $wrapper = unserialize(serialize($wrapper)); var_dump($wrapper->getObject());
Output for git.master, git.master_jit
Deprecated: WrapperObject implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /in/7vCcn on line 14 object(ObjectWithReferences)#2 (2) { ["var1":protected]=> object(stdClass)#3 (0) { } ["var2":protected]=> object(stdClass)#3 (0) { } } Notice: unserialize(): Error at offset 82 of 83 bytes in /in/7vCcn on line 36 bool(false)
Output for rfc.property-hooks
Deprecated: WrapperObject implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /in/7vCcn on line 14 object(ObjectWithReferences)#2 (2) { ["var1":protected]=> object(stdClass)#3 (0) { } ["var2":protected]=> object(stdClass)#3 (0) { } } Warning: unserialize(): Error at offset 82 of 83 bytes in /in/7vCcn on line 36 bool(false)

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:
64.71 ms | 401 KiB | 8 Q