Bug #16045: count($array) logical error
| From: | dennispopel at lycos dot com | Date: | Wed, 13 Mar 2002 20:11:09 +0000 |
| Subject: | Bug #16045: count($array) logical error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-2406@lists.php.net to get a copy of this message | ||
From: dennispopel@lycos.com
Operating system: All
PHP version: 4.1.1
PHP Bug Type: *General Issues
Bug description: count($array) logical error
Hello,
Funny logical error:
if we have a simple variable, say
$x = 1
then
count($x) == 1, which is "natural" (I don't think so)
And if we have an array
$x[0] = 1;
count($x) == 1,
but after
UnSet($x[0])
we still have
count($x) = 1!
This leads to a very special kind of logical errors which are really hard
to track.
My suggestion:
either: introduce explicit type system (with unions, structs and arrays
;)
or: disable count on variables
--
Edit bug report at http://bugs.php.net/?id=16045&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=16045&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=16045&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=16045&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=16045&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16045&r=support
Expected behavior: http://bugs.php.net/fix.php?id=16045&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16045&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16045&r=submittedtwice