|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9587 obj->method()->method2() doesn't work!!
Submitted: 2001-03-06 15:31 UTC Modified: 2001-12-01 12:09 UTC
From: docwhat at gerf dot org Assigned:
Status: Closed Package: Class/Object related
PHP Version: 4.0.4pl1 OS: Linux/Debian(Woody)
Private report: No CVE-ID: None
 [2001-03-06 15:31 UTC] docwhat at gerf dot org
You cannot do the following:


Mini example:
class Foo{
 var $obj;
 setObj( &$obj ) {
   $this->obj =& $obj;

 &getObj() {
   return $this->obj;

 hello() {
   print "hi\n";

$a = new Foo;
$b = new Foo;
$b->setObj( $a );

// Doesn't work

In fact, this doesn't work either:
function foob() {
  global $a;
  return $a;


In addition, anything that hands objects back doesn't work
right.  You can't chain certain things, like new commands.

All in all, the objects are rather inflexable.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-08 12:43 UTC]
Yes, this is a known problem. 
 [2001-12-01 12:09 UTC]
Not a bug, closing.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 09:01:29 2024 UTC