#50225 [NEW]: count() on undefined var does not trigger NOTICE
| From: | josh dot ribakoff at gmail dot com | Date: | Thu, 19 Nov 2009 07:54:09 +0000 |
| Subject: | #50225 [NEW]: count() on undefined var does not trigger NOTICE | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-144787@lists.php.net to get a copy of this message | ||
From: josh dot ribakoff at gmail dot com
Operating system: Windows Vista
PHP version: 5.3.0
PHP Bug Type: Scripting Engine problem
Bug description: count() on undefined var does not trigger NOTICE
Description:
------------
Example A "compiles" and B does not (E_NOTICE).
Invoking an array index on NULL *probably* warrants my attention more than
doing so on an array.
It has cost me countless hours, for one.
Reproduce code:
---------------
// A
$foo = null;
count( $foo['bar'] );
// B
$foo = array();
count( $foo['bar'] );
Expected result:
----------------
2 E_NOTICE errors
Actual result:
--------------
1 E_NOTICE error
--
Edit bug report at http://bugs.php.net/?id=50225&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50225&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50225&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50225&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50225&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50225&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50225&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50225&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50225&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50225&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50225&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50225&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50225&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50225&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50225&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50225&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50225&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50225&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50225&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50225&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50225&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50225&r=mysqlcfg