php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1222 $this point does not contain function list
Submitted: 1999-03-11 14:51 UTC Modified: 1999-03-13 08:34 UTC
From: jonsmirl at mediaone dot net Assigned:
Status: Closed Package: Other
PHP Version: 3.0.7 OS: Win95
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jonsmirl at mediaone dot net
New email:
PHP Version: OS:

 

 [1999-03-11 14:51 UTC] jonsmirl at mediaone dot net
A pointer to an object is not behaving the same as the $this pointer inside of the same object.

$obj = new oObject;
$obj->checkme($obj);

class oObject {
    function checkme($obj) { 

// this list will include the member function and properties
        while ( list( $key, $val ) = each( $obj ) ) { 
            printf("AA %s => %s (%s)", $key, $val, gettype($val)); 
        } 

// this list only shows the properties
        while ( list( $key, $val ) = each( $this ) ) { 
            printf("BB %s => %s (%s)", $key, $val, gettype($val)); 
        } 
    }
}

I would have expected the $this pointer to provide me with the list of functions too.

I need this function list to construct a remote proxy to the object.

Jon Smirl
jonsmirl@mediaone.net

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-03-13 08:34 UTC] sas
You are not resetting the object properly. This works:

class Object {
    function checkme($obj) {
        reset($obj);

        while(list($key, $val) = each($obj)) {
            printf("AA %s => %s (%s)\n", $key, $val, gettype($val));
        }

        reset($this);

        while(list($key, $val) = each($this)) {
            printf("BB %s => %s (%s)\n", $key, $val, gettype($val));
        }
    }
}

$obj = new Object;
$obj->checkme($obj);


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 03 13:01:26 2024 UTC