php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #151 unset($array["key"]) cuts the whole rest of $array
Submitted: 1998-03-06 09:08 UTC Modified: 1998-03-21 06:36 UTC
From: short at ucw dot cz Assigned: zeev (profile)
Status: Closed Package: Other
PHP Version: 3.0b6 OS: Linux 2.1,glibc2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: short at ucw dot cz
New email:
PHP Version: OS:

 

 [1998-03-06 09:08 UTC] short at ucw dot cz
function bug() { $a["a"]="1"; $a["b"]="2"; $a["c"]="3"; /*>>>*/ unset($a["b"]);
for (reset($a);current($a);next($a)) print current($a); }
Previous function outputs only "1" but IMHO should "13".
Note - { print $a["c"]; } still outputs "3"!

P.S.: Current version is still pretty buggy - SEGV quite often but only randomly. :-(

Compiled with apache-1.2.5-ssl and Postgres95.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-03-21 06:36 UTC] zeev
Unsetting an array element doesn't completely erase it.
I'll fix next() so that it works properly, but that loop
is bad anyway, as it doesn't handle arrays with empty
elements.

--
count()/each()/next()/prev()/reset()/end() were patched
to walk around this implementation side effect.  Users
should no longer be able to notice it, even though it'll
be fixed the Right Way(tm) on 3.1 only.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 19:01:33 2024 UTC