php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5204 unset global arrays
Submitted: 2000-06-23 15:43 UTC Modified: 2000-06-24 02:12 UTC
From: eyvonne at esharp dot net Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0.0 Release OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: eyvonne at esharp dot net
New email:
PHP Version: OS:

 

 [2000-06-23 15:43 UTC] eyvonne at esharp dot net
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'




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-24 02:12 UTC] stas at cvs dot php dot net
Do not try to unset "global" variable. Unset $GLOBALS["foo"].
Unsetting "global" does nothing useful.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 23 18:01:35 2024 UTC