Date: 09/30/00
- Next message: sb <email protected>: "[PHP-DEV] PHP 4.0 Bug #6963: parse_url() crashes"
- Previous message: Sebastian Bergmann: "[PHP-DEV] PHP Presents"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: rubein <email protected>
Operating system: Linux 2.2.16
PHP version: 4.0.1pl2
PHP Bug Type: Scripting Engine problem
Bug description: Unsetting a global object in a function doesn't affect other functions
script:
<?
class TEST {
var $foo;
}
function one()
{
global $object;
$object = new TEST();
$object->foo = "bar";
echo "\none() dump of object before unset\n";
var_dump($object);
unset($object);
echo "\none() dump of object after unset\n";
var_dump($object);
two();
}
function two()
{
global $object;
echo "\ntwo() dump of object after unset\n";
var_dump($object);
}
echo "<PRE>\n";
one();
echo "\n(no function) dump of object after unset\n";
var_dump($object);
produces:
one() dump of object before unset
object(test)(1) {
["foo"]=>
string(3) "bar"
}
one() dump of object after unset
NULL
two() dump of object after unset
object(test)(1) {
["foo"]=>
string(3) "bar"
}
(no function) dump of object after unset
object(test)(1) {
["foo"]=>
string(3) "bar"
}
unset()ing an globally defined object within a function doesn't unset it globally - it can still be referred to in other functions.
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: sb <email protected>: "[PHP-DEV] PHP 4.0 Bug #6963: parse_url() crashes"
- Previous message: Sebastian Bergmann: "[PHP-DEV] PHP Presents"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

