#29098 [Opn]: new operator crashes script
ID: 29098 Updated by: [EMAIL PROTECTED] Reported By: antonr at game dot permonline dot ru Status: Open Bug Type: Reproducible crash Operating System: Irrelevant PHP Version: 5CVS-2004-07-12 (dev) New Comment: Reproducable under Win2k with latest snapshot, but works ok under Linux. Valgrind doesn't show any errors about it. Previous Comments: [2004-07-13 16:11:38] fixxxer at php5 dot ru Updating to the latest snapshot seems to fix the problem. [2004-07-12 19:56:03] antonr at game dot permonline dot ru Bug is independent of OS [2004-07-12 19:47:52] antonr at game dot permonline dot ru Linux Mandrake 10.0: the same behaviour. [2004-07-12 06:58:58] antonr at game dot permonline dot ru On last snap Jul 12, 2004 02:30 GMT php-cgi.exe outputs nothing to browser and crushes. php.exe outputs: ChildClass::__destruct()br ParentClass::__construct()br and then crushes. One else bug: why ChildClass::__destruct are called before ParentClass::__construct? You see, the reference on ChildClass instance must be passed to ParentClass::__construct. If I change the line new ParentClass(new ChildClass()); to $a = new ParentClass(new ChildClass()); php-cgi.exe and php.exe output same result: ParentClass::__construct()br ChildClass::setParent()br ParentClass::__destruct()br ChildClass::__destruct()br and not crash. [2004-07-11 23:07:32] [EMAIL PROTECTED] How do you mean possibly? My output with script given: PHP Fatal error: Call to a member function setParent() on a non-object in test.php on line 7 ParentClass::__destruct()br The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/29098 -- Edit this bug report at http://bugs.php.net/?id=29098edit=1
#29098 [Opn]: new operator crashes script
ID: 29098 User updated by: antonr at game dot permonline dot ru Reported By: antonr at game dot permonline dot ru Status: Open Bug Type: Reproducible crash Operating System: WinXP Pro SP1 PHP Version: 5CVS-2004-07-12 (dev) New Comment: Linux Mandrake 10.0: the same behaviour. Previous Comments: [2004-07-12 06:58:58] antonr at game dot permonline dot ru On last snap Jul 12, 2004 02:30 GMT php-cgi.exe outputs nothing to browser and crushes. php.exe outputs: ChildClass::__destruct()br ParentClass::__construct()br and then crushes. One else bug: why ChildClass::__destruct are called before ParentClass::__construct? You see, the reference on ChildClass instance must be passed to ParentClass::__construct. If I change the line new ParentClass(new ChildClass()); to $a = new ParentClass(new ChildClass()); php-cgi.exe and php.exe output same result: ParentClass::__construct()br ChildClass::setParent()br ParentClass::__destruct()br ChildClass::__destruct()br and not crash. [2004-07-11 23:07:32] [EMAIL PROTECTED] How do you mean possibly? My output with script given: PHP Fatal error: Call to a member function setParent() on a non-object in test.php on line 7 ParentClass::__destruct()br [2004-07-11 20:35:32] antonr at game dot permonline dot ru Description: When new operator appears without = operator, it is possibly crashes php Reproduce code: --- ?php class ParentClass { private $child; public function __construct($child) { echo ParentClass::__construct()br\n; $this-child = $child; $child-setParent($this); } public function __destruct() { echo ParentClass::__destruct()br\n; unset($this-child); } } class ChildClass { private $parent; public function setParent($parent) { echo ChildClass::setParent()br\n; $this-parent = $parent; } public function __destruct() { echo ChildClass::__destruct()br\n; unset($this-parent); } } new ParentClass(new ChildClass()); ? Expected result: ParentClass::__construct() ChildClass::setParent() and possibly ChildClass::__destruct() ParentClass::__destruct() Actual result: -- php crashes -- Edit this bug report at http://bugs.php.net/?id=29098edit=1
#29098 [Opn]: new operator crashes script
ID: 29098 User updated by: antonr at game dot permonline dot ru Reported By: antonr at game dot permonline dot ru Status: Open Bug Type: Reproducible crash -Operating System: WinXP Pro SP1 +Operating System: Irrelevant PHP Version: 5CVS-2004-07-12 (dev) New Comment: Bug is independent of OS Previous Comments: [2004-07-12 19:47:52] antonr at game dot permonline dot ru Linux Mandrake 10.0: the same behaviour. [2004-07-12 06:58:58] antonr at game dot permonline dot ru On last snap Jul 12, 2004 02:30 GMT php-cgi.exe outputs nothing to browser and crushes. php.exe outputs: ChildClass::__destruct()br ParentClass::__construct()br and then crushes. One else bug: why ChildClass::__destruct are called before ParentClass::__construct? You see, the reference on ChildClass instance must be passed to ParentClass::__construct. If I change the line new ParentClass(new ChildClass()); to $a = new ParentClass(new ChildClass()); php-cgi.exe and php.exe output same result: ParentClass::__construct()br ChildClass::setParent()br ParentClass::__destruct()br ChildClass::__destruct()br and not crash. [2004-07-11 23:07:32] [EMAIL PROTECTED] How do you mean possibly? My output with script given: PHP Fatal error: Call to a member function setParent() on a non-object in test.php on line 7 ParentClass::__destruct()br [2004-07-11 20:35:32] antonr at game dot permonline dot ru Description: When new operator appears without = operator, it is possibly crashes php Reproduce code: --- ?php class ParentClass { private $child; public function __construct($child) { echo ParentClass::__construct()br\n; $this-child = $child; $child-setParent($this); } public function __destruct() { echo ParentClass::__destruct()br\n; unset($this-child); } } class ChildClass { private $parent; public function setParent($parent) { echo ChildClass::setParent()br\n; $this-parent = $parent; } public function __destruct() { echo ChildClass::__destruct()br\n; unset($this-parent); } } new ParentClass(new ChildClass()); ? Expected result: ParentClass::__construct() ChildClass::setParent() and possibly ChildClass::__destruct() ParentClass::__destruct() Actual result: -- php crashes -- Edit this bug report at http://bugs.php.net/?id=29098edit=1