php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6347 Methods called by call_user_method() misbehave
Submitted: 2000-08-25 06:06 UTC Modified: 2000-08-25 06:09 UTC
From: bachi at insign dot ch Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0.1pl2 OS: Linux
Private report: No CVE-ID: None
 [2000-08-25 06:06 UTC] bachi at insign dot ch
If you call a object method with call_user_method(), it can't handle its own object properties anymore. The demo below returns 1,2,3 for the direct calls as expected, but then just 4,4,4 for the indirect calls.    

class test
    {
        var $a=0;

        function increase()
        {
            $this->a++;
            echo "a is now: ".$this->a."\n<br>";
        }

    }


    $t = new test();

    echo "Direct calls:\n<br>";
    $t->increase();
    $t->increase();
    $t->increase();

    echo "<p>\n\nIndirect calls:\n<br>";

    call_user_method ("increase", $t);
    call_user_method ("increase", $t);
    call_user_method ("increase", $t);

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-25 06:09 UTC] andi@php.net
Please try 4.0.2RC1 available at http://www.php.net/~andi
I should have fixed this and I think the fix made it into RC1. If this still is a problem please open a new bug report.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 03 13:01:28 2024 UTC