#44566 [NEW]: Incorrect variable assignment doesn't cause parse error
| From: | Jonathon dot Reinhart at gmail dot com | Date: | Sun, 30 Mar 2008 00:50:13 +0000 |
| Subject: | #44566 [NEW]: Incorrect variable assignment doesn't cause parse error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-123773@lists.php.net to get a copy of this message | ||
From: Jonathon dot Reinhart at gmail dot com
Operating system: Linux (Suse 10.2)
PHP version: 5.2.5
PHP Bug Type: Scripting Engine problem
Bug description: Incorrect variable assignment doesn't cause parse error
Description:
------------
Simply putting a dollar sign ($) with no variable name afterwards, and no
semicolon does not cause any error.
Reproduce code:
---------------
Example 1 (Gives no error):
<?php
$a = $
$b = 1;
?>
Example 2
Notice: Undefined variable: b in /srv/test2/htdocs/phpbug.php on line 4
<?php
error_reporting(E_ALL | E_STRICT);
$a = $
$b = 1;
?>
Expected result:
----------------
Expected to see a parse error on line 2 of Example 1. Wouldn't expect the
parser to continue looking after a "$" for a variable name after a "\n".
Actual result:
--------------
No error in Example 1. Incorrect error in Example 2.
--
Edit bug report at http://bugs.php.net/?id=44566&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44566&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44566&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44566&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44566&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44566&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44566&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44566&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44566&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44566&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44566&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44566&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44566&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44566&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44566&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44566&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44566&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44566&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44566&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44566&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44566&r=mysqlcfg