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
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: 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

Add a Patch

Pull Requests

Add a Pull Request

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 Mar 28 15:01:29 2024 UTC