PHP 4.0 Bug #5204: unset global arrays
| From: | eyvonne at esharp dot net | Date: | Fri, 23 Jun 2000 13:43:50 +0000 |
| Subject: | PHP 4.0 Bug #5204: unset global arrays | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-22117@lists.php.net to get a copy of this message | ||
From: eyvonne@esharp.net
Operating system: FreeBSD
PHP version: 4.0.0 Release
PHP Bug Type: Misbehaving function
Bug description: unset global arrays
As previously reported in bug report # 1971..
I am running the 4.0.0 release of PHP and can not access global variables outside of the function
when the arrays had been reset with unset().
Here's the function :
function get_images($lognum) {
global $small_images, $large_images, $num_images;
$ls_command = "ls pics/logs/" . $lognum . "s*.jpg";
$image_name = "pics/logs/" . $lognum . "s.jpg";
if (file_exists($image_name)) {
unset($small_images);
exec($ls_command,$small_images);
$ls_command = "ls pics/logs/" . $lognum . "l*.jpg";
unset($large_images);
exec($ls_command,$large_images);
$num_images = count($small_images);
}
else
$num_images = -1;
}
Then when I do:
get_images($row["lognum"]);
print $small_images[0];
I get no values returned. When I comment the unset lines everything works perfectly.
When I run a phpinfo(), here is some of the information that's provided:
FreeBSD my.systemname.com 4.0-RELEASE FreeBSD 4.0-RELEASE #0: Mon Mar
20 22:50:22 GMT 2000
root@monster.cdrom.com:/usr/src/sys/compile/GENERIC i386
'./configure' '--prefix=/usr/local' 'i386--freebsd4.0'
'--with-system-regex'
'--with-apache=/usr/ports/www/apache13-php4/work/apache_1.3.12'
'--with-config-file-path=/usr/local/etc'
'--disable-debug' '--enable-track-vars'
'--without-gd' '--disable-pear'
'--with-zlib' '--with-mcrypt=/usr/local'
'--with-xml=/usr/local'
'--enable-ftp'