#44566 [Opn->Bgs]: Incorrect variable assignment doesn't cause parse error
| From: | derick@php.net | Date: | Sun, 30 Mar 2008 14:02:17 +0000 |
| Subject: | #44566 [Opn->Bgs]: Incorrect variable assignment doesn't cause parse error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-123782@lists.php.net to get a copy of this message | ||
ID: 44566
Updated by: derick@php.net
Reported By: Jonathon dot Reinhart at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Linux (Suse 10.2)
PHP Version: 5.2.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
No bug, it's just parsed like:
$a = $$b = 1;
Previous Comments:
------------------------------------------------------------------------
[2008-03-30 00:50:12] Jonathon dot Reinhart at gmail dot com
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 this bug report at http://bugs.php.net/?id=44566&edit=1