php.net |  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
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: docwhat at gerf dot org
New email:
PHP Version: OS:

 

 [2001-03-06 15:31 UTC] docwhat at gerf dot org
You cannot do the following:

obj->method()->method2();

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 );

$a->getObj()->hello();
// Doesn't work

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

foo()->hello();

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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-08 12:43 UTC] stas@php.net
Yes, this is a known problem. 
 [2001-12-01 12:09 UTC] sebastian@php.net
Not a bug, closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 22 06:01:30 2024 UTC