ZE2 'breaks' global?
| From: | Carl Drinkwater | Date: | Thu, 20 Jun 2002 20:20:19 +0000 |
| Subject: | ZE2 'breaks' global? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-85411@lists.php.net to get a copy of this message | ||
Hi all,
I was playing with 4.3.0+ZE2 (fresh out of CVS) this afternoon and came
across this - I was just wondering if this is a intended feature of ZE2 or
not ... Here is a script ...
<?
class Team {
function Team() {
global $Manager;
if ( is_object( $Manager ) ) {
$Manager->Employ();
}
}
}
class Manager {
function Employ() {
echo "I'm employed!";
}
}
$Team = new Team();
?>
... That when under ZE1 works quite happily, producing "I'm employed". Now,
under ZE2, it gives the error ...
Fatal error: Can't assign by reference non-referencable value! in
globalclass.php on line 4
This is fixed by instantiating $Manager, or in fact assigning it any value
what so ever, it just have to exist globally. It also works as desired if
using $GLOBALS["Manager"] instead of 'global $Manager'.
Regardless of the workarounds, I'm wondering if this is an intended
'feature' or is a bug ...
Regards,
Carl.
--
TopTheTable.com - Online Multiplayer Football Management
Sign up for free at www.topthetable.com and play against
other managers from all around the world.