#39783 [Bgs]: highlight_string function removes slashes in some cases

From: Date: Sun, 10 Dec 2006 22:07:13 +0000
Subject: #39783 [Bgs]: highlight_string function removes slashes in some cases
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-106168@lists.php.net to get a copy of this message
ID: 39783 User updated by: tikitiki at mybboard dot com Reported By: tikitiki at mybboard dot com Status: Bogus Bug Type: Unknown/Other Function Operating System: Not Applicable PHP Version: 5.2.0 New Comment: Well, maybe this can be a suggestion then? highlighting should return the full script even if it's malformed. If it's invalid then it shouldn't highlight it, just return it plain Previous Comments: ------------------------------------------------------------------------ [2006-12-10 19:49:52] 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 Non-valid characters are ignored by the parser in the instance of highlight_string() or file. ------------------------------------------------------------------------ [2006-12-09 19:37:47] tikitiki at mybboard dot com Description: ------------ The slashes (\) gets removed in some instances with invalid php code. In the below reproduce code, the \ gets removed. The PHP Version isn't applicable, but I had to put 5.2.0 because if I set it to 'Irrelevant' I would get this error 'This category requires you to pick a PHP version.' I understand that this is far fetched, but it should ATLEAST show up. Reproduce code: --------------- <?php $string = '<?php $a = 2; \ $c = 5; ?>'; echo highlight_string($str, true); ?> Expected result: ---------------- <?php $a = 2; \ $c = 5; ?> Actual result: -------------- <?php $a = 2; $c = 5; ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39783&edit=1

« previous php.bugs (#106168) next »