Bug #2675 Updated: Misbehavior of object initializers
| From: | Bug Database | Date: | Sat, 06 Nov 1999 04:38:17 +0000 |
| Subject: | Bug #2675 Updated: Misbehavior of object initializers | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-12160@lists.php.net to get a copy of this message | ||
ID: 2675
User Update by: zerodiv@zerodivide.net
Status: Open
Bug Type: Other
Description: Misbehavior of object initializers
<?php
class Foo {
var $type;
Function Foo() {
$this->type = 'Foo';
}
}
class Bar {
var $type;
Function Bar() {
$this->type = 'Bar';
return new Foo();
}
}
// This will work
$foo = new Foo();
echo( 'I am foo : ' . $foo->type );
// This will not
$bar = new Bar();
echo( 'I should be foo also : ' . $bar->type
);
?>
Full Bug description available at: http://bugs.php.net/?id=2675