ID: 31399
Updated by: [EMAIL PROTECTED]
Reported By: sveta at microbecal dot com
Status: Bogus
Bug Type: Documentation problem
PHP Version: 5CVS-2005-01-04 (dev)
New Comment:
Well... nothing then, as I thought he claimed that on 4.3 it wouldn't
throw a notice.
Previous Comments:
------------------------------------------------------------------------
[2005-01-04 21:51:19] [EMAIL PROTECTED]
[EMAIL PROTECTED]:~$ echo '<?php error_reporting(E_ALL); echo PHP_VERSION
."\n". count($a) ."\n"; ?>' | php
Notice: Undefined variable: a in - on line 1
4.3.4
0
[EMAIL PROTECTED]:~$ echo '<?php error_reporting(E_ALL); echo PHP_VERSION
."\n". count($a) ."\n"; ?>' | php5
Notice: Undefined variable: a in - on line 1
5.0.3
0
I agree with Nuno: E_NOTICE on undefined variable access is (almost)
global, so we should not start documenting this everywhere.
5.0.3 DOES return 0 if undefined.
Derick: If something changed, what is it?
S
------------------------------------------------------------------------
[2005-01-04 21:36:07] [EMAIL PROTECTED]
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
------------------------------------------------------------------------
[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] [EMAIL PROTECTED]
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
------------------------------------------------------------------------
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