Bug #9587 Updated: obj->method()->method2() doesn't work!!

From: Date: Sat, 01 Dec 2001 17:09:01 +0000
Subject: Bug #9587 Updated: obj->method()->method2() doesn't work!!
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-72204@lists.php.net to get a copy of this message
ID: 9587
Updated by: sebastian
Reported By: docwhat@gerf.org
Old Status: Analyzed
Status: Closed
Bug Type: Class/Object related
Operating System: Linux/Debian(Woody)
PHP Version: 4.0.4pl1
New Comment:

Not a bug, closing.

Previous Comments:
------------------------------------------------------------------------

[2001-03-08 12:43:31] stas@php.net

Yes, this is a known problem. 

------------------------------------------------------------------------

[2001-03-06 15:31:04] docwhat@gerf.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.

------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=9587&edit=1



Thread (1 message)

  • sebastian@php.net
  • Unknown Message
    • sebastian@php.net
« previous php.dev (#72204) next »