destructor access to constants
| From: | Ulf Wendel | Date: | Sun, 06 Jul 2003 10:27:00 +0000 |
| Subject: | destructor access to constants | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-3271@lists.php.net to get a copy of this message | ||
Hi,
I'm wondering if it's a bug to give automatically called destructors access to constants (PHP Version 5.0.0b1). I'd expect to be neither able to access global variables nor constants after script termination (die()).
Ulf
$dtor = 'global $dtor variable is visible';
define('DTOR', 'DTOR constant is visible');
class dtor {
function __destruct() {
global $dtor;
printf('$dtor = "%s"<br> DTOR = "%s"<br>', $dtor, DTOR);
}
}
$d1 = new dtor();
unset($d1);
$d2 = new dtor();
die();
generated output:
$dtor = "global $dtor variable is visible"
DTOR = "DTOR constant is visible"
$dtor = ""
DTOR = "DTOR constant is visible"