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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cazzell at eng dot usf dot edu
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2019 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 03:01:20 2019 UTC