#22232 [Opn->Fbk]: Problem with method call
| From: | sniper@php.net | Date: | Sat, 15 Feb 2003 16:34:53 +0000 |
| Subject: | #22232 [Opn->Fbk]: Problem with method call | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-33237@lists.php.net to get a copy of this message | ||
ID: 22232
Updated by: sniper@php.net
Reported By: henrik.gebauer@web.de
-Status: Open
+Status: Feedback
Bug Type: Class/Object related
Operating System: Windows 2000
PHP Version: 4.3.0
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2003-02-15 09:26:45] henrik.gebauer@web.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