#36037 [Asn->Csd]: heredoc adds extra line number
| From: | dmitry@php.net | Date: | Tue, 17 Jan 2006 09:42:48 +0000 |
| Subject: | #36037 [Asn->Csd]: heredoc adds extra line number | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-92050@lists.php.net to get a copy of this message | ||
ID: 36037
Updated by: dmitry@php.net
Reported By: nospam at 1111-internet dot com
-Status: Assigned
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5CVS, 4CVS (2006-01-17) (cvs)
Assigned To: dmitry
New Comment:
Fixed in CVS HEAD, PHP_5_1 and PHP_4_4.
Previous Comments:
------------------------------------------------------------------------
[2006-01-16 22:10:29] tony2001@php.net
Dmitry, check out the patch, plz:
Index: Zend/zend_language_scanner.l
===================================================================
RCS file: /repository/ZendEngine2/zend_language_scanner.l,v
retrieving revision 1.131.2.9
diff -u -p -d -r1.131.2.9 zend_language_scanner.l
--- Zend/zend_language_scanner.l 4 Jan 2006 23:53:04 -0000
1.131.2.9
+++ Zend/zend_language_scanner.l 16 Jan 2006 21:09:17 -0000
@@ -1706,7 +1706,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
<ST_IN_SCRIPTING>"<<<"{TABS_AND_SPACES}{LABEL}{NEWLINE} {
char *s;
- CG(zend_lineno)++;
CG(heredoc_len) = yyleng-3-1-(yytext[yyleng-2]=='\r'?1:0);
s = yytext+3;
while ((*s == ' ') || (*s == '\t')) {
------------------------------------------------------------------------
[2006-01-16 21:58:28] nospam at 1111-internet dot com
Description:
------------
Heredoc syntax adds one extra line number and thus skews all subsequent
script line numbers. Example uses PHP CLI, but also affects PHP as
Apache module.
Reproduce code:
---------------
<?php
echo __LINE__, "\n";
$x=<<<XXX
123
XXX;
echo __LINE__, "\n";
?>
Expected result:
----------------
2
6
Actual result:
--------------
2
7
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36037&edit=1