php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1404 count() bug: count($Array["nonexistent"]) sets $Array["nonexistent"]=""
Submitted: 1999-05-12 11:45 UTC Modified: 1999-11-14 03:54 UTC
From: miko at cnt dot pl Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.6 OS: Linux RH5.2
Private report: No CVE-ID: None
 [1999-05-12 11:45 UTC] miko at cnt dot pl
count($Array["nonexistent"]) sets $Array["nonexistent"]=""
Here is the script:
$T=array();
echo " isset: ".isset($T["a"])." count: ".count($T["a"]);
echo " isset: ".isset($T["a"])." count: ".count($T["a"]);

The result is: isset: 0 count: 1 isset: 1 count: 1, while I would expect
it to be: 0 0 0 0 (or 0 1 0 1).

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-11-14 03:54 UTC] joey at cvs dot php dot net
Fixed in php 4. I think this may have been
on of those due to "fake arrays"?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 20:01:32 2024 UTC