php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22232 Problem with method call
Submitted: 2003-02-15 09:26 UTC Modified: 2003-02-18 11:39 UTC
From: henrik dot gebauer at web dot de Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.3.0 / 4.3.1-dev OS: Windows 2000
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: henrik dot gebauer at web dot de
New email:
PHP Version: OS:

 

 [2003-02-15 09:26 UTC] 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);

?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-15 10:34 UTC] 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 15:24 UTC] 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-18 11:39 UTC] moriyoshi@php.net
Duplicate of bug #22231 (fixed in cvs)

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 15:01:32 2024 UTC