#49883 [Opn->Bgs]: The parser doesn't distinguish periods after integers as concatenations
| From: | scottmac@php.net | Date: | Thu, 15 Oct 2009 03:04:33 +0000 |
| Subject: | #49883 [Opn->Bgs]: The parser doesn't distinguish periods after integers as concatenations | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-143583@lists.php.net to get a copy of this message | ||
ID: 49883
Updated by: scottmac@php.net
Reported By: svavar at kjarrval dot is
-Status: Open
+Status: Bogus
Bug Type: Compile Failure
Operating System: FreeBSD 7.2
PHP Version: 5.2.11
New Comment:
Surround your expression with parentheses to get your expected
behavior.
The lexer treats this as a float, not the parser.
Previous Comments:
------------------------------------------------------------------------
[2009-10-15 01:27:04] svavar at kjarrval dot is
Description:
------------
The parser thinks that a period after an integer must mean the number
is a float, even though the period represents a concatenation of a
string.
Reproduce code:
---------------
<?php
$time = 2000;
echo $time/1000.' seconds'; // doesn't work
//echo $time/1000..' seconds'; // works - when not commented
out
?>
Expected result:
----------------
To see the following output:
2 seconds
Actual result:
--------------
The parser outputs a syntax error:
unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49883&edit=1