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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
31 - 17 = ?
Subscribe to this entry?

 
 [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 Jun 03 07:01:33 2024 UTC