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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: miko at cnt dot pl
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 15:01:33 2025 UTC