3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class SEGV { private $obj; public function __construct() { } // there should be construct to get SEGV public function segv() { $this->obj->attribute = "TEST"; } public function getObj() { return $this->obj; } } $s = new SEGV; //$s->segv(); // if value of obj is set from the inside of class, it will not get SEGV. $s->getObj()->attribute["TEST"] = "TEST"; // member value is set from the outside of class $s->segv(); // this set function will get SEGV $s->segv(); echo "SUCCESS\
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in /in/8Elfa on line 21
Process exited with code 255.
Output for 5.3.3 - 5.3.28
Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in /in/8Elfa on line 21
Process exited with code 255.
Output for 5.3.0 - 5.3.2
Strict Standards: Redefining already defined constructor for class SEGV in /in/8Elfa on line 7 Parse error: syntax error, unexpected $end, expecting T_VARIABLE or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN in /in/8Elfa on line 21
Process exited with code 255.