#22232 [Opn->Bgs]: Problem with method call

From: Date: Tue, 18 Feb 2003 17:39:18 +0000
Subject: #22232 [Opn->Bgs]: Problem with method call
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-33434@lists.php.net to get a copy of this message
ID: 22232 Updated by: moriyoshi@php.net Reported By: henrik dot gebauer at web dot de -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Windows 2000 PHP Version: 4.3.0 / 4.3.1-dev New Comment: Duplicate of bug #22231 (fixed in cvs) Previous Comments: ------------------------------------------------------------------------ [2003-02-15 15:24:29] henrik dot gebauer at web dot de I get the same warning and fatal error with the latest CVS snapshot. Warning: Problem with method call - please report this bug in E:\hosts\tests\test.php on line 17 Fatal error: Call to a member function on a non-object in E:\hosts\tests\test.php on line 33 ------------------------------------------------------------------------ [2003-02-15 10:34:53] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip I get only this fatal error: Fatal error: Call to a member function on a non-object in /home/jani/t.php on line 17 ------------------------------------------------------------------------ [2003-02-15 09:26:45] henrik dot gebauer at web dot de I don't know if it is the same bug as this one: http://bugs.php.net/bug.php?id=22231&edit=2 <?php class foo { function bar() {} } function &foo() { $GLOBALS['foo'] =& new foo; return $GLOBALS['foo']; } /* The following lines cause a warning: Problem with method call - please report this bug */ $foo =& foo(); $foo->bar('value'); unset($foo); /* A method call without a value does not cause the warning. */ $foo =& foo(); $foo->bar(/* no value */); unset($foo); /* But the two lines together cause a fatal error: Call to a member function on a non-object */ $foo =& foo(); $foo->bar(/* no value */); $foo->bar('value'); // the error occurs in this line! unset($foo); ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22232&edit=1

« previous php.bugs (#33434) next »