#26629 [Opn->Bgs]: Inconsistent handle of \n in highlight_string and highlight_file

From: Date: Wed, 17 Dec 2003 09:31:47 +0000
Subject: #26629 [Opn->Bgs]: Inconsistent handle of \n in highlight_string and highlight_file
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-52202@lists.php.net to get a copy of this message
ID: 26629 Updated by: derick@php.net Reported By: vrana@php.net -Status: Open +Status: Bogus Bug Type: Strings related PHP Version: 4.3.4 New Comment: Because the lexer in PHP handles those cases different. "$a\n" = quote + variable + newline character + quote "a\n" = string Try this script: <pre> <?php highlight_string('<?php "a\n"; ?>'); var_dump(token_get_all('<?php "a\n"; ?>')); highlight_string('<?php "$a\n"; ?>'); var_dump(token_get_all('<?php "$a\n"; ?>')); ?> </pre> (and leave this bug bogus) Previous Comments: ------------------------------------------------------------------------ [2003-12-17 03:51:38] vrana@php.net Tell me a reason why \n should be highlighted as keyword in "$a\n" and in "a\n" not. ------------------------------------------------------------------------ [2003-12-16 17:11:51] derick@php.net You're wrong. The current behavior is correct. ------------------------------------------------------------------------ [2003-12-16 17:01:57] vrana@php.net I don't know what "1 string" is. Is "$a\n" also "1 string"? If it is, there should not be \n highlighted in it. The problem is that in "$a\n" is \n highlighted and in "a\n" isn't. I believe that it should be consistent. ------------------------------------------------------------------------ [2003-12-16 12:22:20] iliaa@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 This is how it supposed to work, "a\n" is 1 string. ------------------------------------------------------------------------ [2003-12-16 12:08:14] vrana@php.net Sorry for mismatch. The bug report is for PHP 4. I looked for highlighting code and I found it in /ZendEngine2 but I didn't realized that this code is for PHP 5 only. I don't know where this part of code for PHP 4 is. Just ignore the sentence in bracket, the provided version information is correct. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/26629 -- Edit this bug report at http://bugs.php.net/?id=26629&edit=1

« previous php.bugs (#52202) next »