Fw: [PHP-DEV] PHP 4.0 Bug #7890 Updated: Recursion problem with isset and unset
| From: | Jon Tai | Date: | Wed, 22 Nov 2000 02:53:41 +0000 |
| Subject: | Fw: [PHP-DEV] PHP 4.0 Bug #7890 Updated: Recursion problem with isset and unset | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-38872@lists.php.net to get a copy of this message | ||
Would it be possible to add hholzgra's comments to the PHP manual under
variable scope or unset()? That would be very helpful; I was just as
confused as Nick was as to why his script didn't work.
- Jon
----- Original Message -----
From: <hholzgra@php.net>
To: <php-dev@lists.php.net>
Sent: Monday, November 20, 2000 5:00 AM
Subject: [PHP-DEV] PHP 4.0 Bug #7890 Updated: Recursion problem with isset
and unset
ID: 7890
Updated by: hholzgra
Reported By: nickj@ihug.com.au
Status: Closed
Bug Type: Scripting Engine problem
Assigned To:
Comments:
'global $test' creates a reference to $GLOBALS['test']
and 'unset($test)' will only unset this reference
you have to write 'unset($GLOBALS['test']) to unset
the variable in the global scope
Previous Comments:
---------------------------------------------------------------------------
[2000-11-20 06:58:44] nickj@ihug.com.au
I have a problem with a recursive function call that does not work as I
would expect. A short script that reproduces the problem is:
<?php
function fn() {
global $test;
if (isset($test)) {
print "test is set<br>n";
unset($test);
fn();
}
else {
print "test is NOT set<br>n";
}
}
$test = array("exam_id" => "MATH_101", "exam_code" =>
"Mathematics
Intro");
fn();
?>
What Happens: - out produced is:
test is set
test is set
test is set
test is set
test is set
test is set
... [and so on] ...
What I would expect to happen - looking for this output:
test is set
test is NOT set
[end of output]
Setup Information:
Configure command from phpinfo() gives: "'./configure'
'--with-apxs=/usr/sbin/apxs' '--without-mysql' '--disable-static'
'--disable-debug' '--enable-pic' '--enable-inline-optimization'
'--prefix=/usr' '--with-zlib' '--with-config-file-path=/etc'
'--enable-magic-quotes' '--enable-debugger' '--enable-track-vars'
'--enable-safe-mode' '--with-exec-dir=/usr/bin' '--with-regex=system'
'--with-versioning' '--enable-dba=shared' '--with-gdbm'
'--with-db2'
'--enable-sysvsem' '--enable-sysvshm' '--with-mod_charset'
'--enable-force-cgi-redirect' '--with-mm' '--enable-trans-sid'
'--with-dbase' '--with-filepro' '--enable-yp' '--enable-ftp'
'--with-xml'
'--with-gettext'"
Also using Zend engine (don't know if this is relevant) : "This program
makes use of the Zend scripting language engine: Zend Engine v1.0.3,
Copyright (c) 1998-2000 Zend Technologies with Zend Optimizer v0.99,
Copyright (c) 1998-2000, by Zend Technologies"
Any other information I can supply that would assist, just email me and let
me know. Of course, it could just be something obviously and embarrassingly
wrong in the code above, but if it is, I honestly can't see it.
Cheers,
Nick.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7890
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
For additional commands, e-mail: php-dev-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net