From: sveta at microbecal dot com
Operating system:
PHP version: 5CVS-2005-01-04 (dev)
PHP Bug Type: Documentation problem
Bug description: PHP5 incorrect count description
Description:
------------
In function.count I see:
"count() may return 0 for a variable that isn't set", but is not true with
PHP5 with E_NOTICE turned on
I have tried to patch it:
--- count.xml 2004-11-03 10:30:02.000000000 +0300
+++ count_new.xml 2005-01-01 19:45:24.000000000 +0300
@@ -53,6 +53,8 @@
isn't set, but it may also return 0 for a variable that has
been initialized with an empty array. Use
<function>isset</function> to test if a variable is set.
+ Since PHP 5.0.0, <function>count</function> generates warning of
level
+ <link linkend="errorfunc.constants">E_NOTICE</link> in case of
taking non-initialized variable as parameter.
</para>
</caution>
<para>
Reproduce code:
---------------
count($x);
Expected result:
----------------
0
Actual result:
--------------
Notice: Undefined variable: x in D:\My
Documents\web_project\PHP.lessons\www\reflection.php on line 3
--
Edit bug report at http://bugs.php.net/?id=31399&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31399&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31399&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31399&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31399&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31399&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31399&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31399&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31399&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31399&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31399&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31399&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31399&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31399&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31399&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31399&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31399&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31399&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31399&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31399&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31399&r=mysqlcfg