Req #40144 [Opn->Wfx]: Returning int . string gives parse error
| From: | nikic@php.net | Date: | Sun, 17 Feb 2013 12:47:21 +0000 |
| Subject: | Req #40144 [Opn->Wfx]: Returning int . string gives parse error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176682@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=40144&edit=1
ID: 40144
Updated by: nikic@php.net
Reported by: Quis at omicidio dot nl
Summary: Returning int . string gives parse error
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: FreeBSD
PHP Version: 5.2.0
Block user comment: N
Private report: N
New Comment:
1. is a floating point literal, so what you have there is a float followed by a string (with nothing
in between), which give you the error. We can't really fix this unless we remove the short
floating point syntaxes (1. and .1). I don't think we will do that (just for BC reasons
already).
Previous Comments:
------------------------------------------------------------------------
[2007-01-16 14:17:33] Quis at omicidio dot nl
Well,
Then i`ll make it an RfC :)
------------------------------------------------------------------------
[2007-01-16 14:03:42] tony2001@php.net
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
------------------------------------------------------------------------
[2007-01-16 13:50:20] Quis at omicidio dot nl
The 'actual' code I got this error on was:
echo 1.str_repeat('sometext', 3);
Also resulting in Parse error: syntax error, unexpected T_STRING, expecting ',' or
';'
------------------------------------------------------------------------
[2007-01-16 13:47:52] Quis at omicidio dot nl
Description:
------------
Unexpected parse error
Reproduce code:
---------------
Not working:
echo 1.'sometext';
or,
return 1.'sometext';
Working:
$i=1;
echo $i.'sometext';
Expected result:
----------------
1sometext
Actual result:
--------------
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or
';'
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=40144&edit=1