php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9090 call_user_method() duplicates object
Submitted: 2001-02-03 17:21 UTC Modified: 2001-10-21 19:11 UTC
From: cazzell at eng dot usf dot edu Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.0.4pl1 OS: linux 2.4
Private report: No CVE-ID: None
 [2001-02-03 17:21 UTC] cazzell at eng dot usf dot edu
First some sample code:


class foo {
	var $bar = 0;
	function increase () {
		$this->bar++;
	}
}

$foo = new foo;

print "Bar: " . $foo->bar . "\n";
call_user_method('increase', $foo);
print "Bar: " . $foo->bar . "\n";

$foo->increase();
print "Bar: " . $foo->bar . "\n";


This will output:

Bar: 0
Bar: 0
Bar: 1

It appears that call_user_method is working on a copy of the object rather than the object itself.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-17 03:01 UTC] cazzell at eng dot usf dot edu
This bug is a duplicate of #9054 and #6347.  Andi attached a message to #6347 saying this would be fixed in 4.0.2, but I'm running 4.0.4pl1 and the bug is still there.
 [2001-10-21 19:11 UTC] sniper@php.net
The report for which this was duplicate is bogused. See #9054 for more information.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC