php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5450 unset ain't doing it's job in functions
Submitted: 2000-07-08 07:42 UTC Modified: 2000-07-08 09:21 UTC
From: gregory at 9voltnet dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.1pl2 OS: linux 2.2.14
Private report: No CVE-ID: None
 [2000-07-08 07:42 UTC] gregory at 9voltnet dot com
<%
  $a = 'value';

  function foo()
  {
    global $a;

    unset($a);
  }

  function bar()
  {
    global $a;

    $a = 0;
  }

  print "$a\n";
  print isset($a) . "\n";

  foo();
  print "$a\n";
  print isset($a) . "\n";

  bar();
  print "$a\n";
  print isset($a) . "\n";
%>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-08 09:21 UTC] stas at cvs dot php dot net
do not use unset on global. Use unset $GLOBALS["a"]
It's really a FAQ already. Probably needs to be added to documentation.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sun Oct 11 15:00:01 2026 UTC