#31399 [Opn->Bgs]: PHP5 incorrect count description
| From: | nlopess@php.net | Date: | Tue, 04 Jan 2005 20:36:08 +0000 |
| Subject: | #31399 [Opn->Bgs]: PHP5 incorrect count description | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969365819@lists.php.net to get a copy of this message | ||
ID: 31399
Updated by: nlopess@php.net
Reported By: sveta at microbecal dot com
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
PHP Version: 5CVS-2005-01-04 (dev)
New Comment:
I don't agree with that change, because if we add such info to count()
we would have to add it to all functions.
If you use an uninitialized var in PHP, you will get a E_NOTICE. This
isn't specific to count().
Nuno
Previous Comments:
------------------------------------------------------------------------
[2005-01-04 18:49:30] sveta at microbecal dot com
OK Lets correct "patch" to:
--- 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.
+ <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>
or to something with similar sence, but better style English
------------------------------------------------------------------------
[2005-01-04 18:49:22] sveta at microbecal dot com
OK Lets correct "patch" to:
--- 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.
+ <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>
or to something with similar sence, but better style English
------------------------------------------------------------------------
[2005-01-04 17:00:06] nlopess@php.net
PHP 4 also gives a warning:
C:\php4>php-cli -r "error_reporting(E_ALL); echo count($a);"
Notice: Undefined variable: a in Command line code on line 1
0
------------------------------------------------------------------------
[2005-01-04 12:46:58] derick@php.net
That was not the point Nuno, thebehavior changed regarding
non-initialized values..that can be documented just fine.
------------------------------------------------------------------------
[2005-01-04 12:15:09] nlopess@php.net
It stills return 0.
Try echoing its value with: '<? echo count($a); ?>'
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/31399
--
Edit this bug report at http://bugs.php.net/?id=31399&edit=1