ID: 45599 User updated by: david at grudl dot com Reported By: david at grudl dot com Status: Bogus Bug Type: Strings related Operating System: * PHP Version: 5.2CVS, 5.3CVS, 6CVS (2008-07-22) New Comment:
Character \ is allowed in tag attribute, so strip_tags('Hello <a href="any\"> World') leading to "Hello" (without "World") is bug. Previous Comments: ------------------------------------------------------------------------ [2008-08-06 16:30:17] [EMAIL PROTECTED] 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 The parser continues until it founds the end of the tag, which can not be in an attribute value (XML allows all characters except [%&'] in attribute values). In the given examples the attribute value never terminates and the end of the tag is never found, which causes the rest of the string to be truncated. This change as been made to fix the following bug: http://bugs.php.net/bug.php?id=40432 ------------------------------------------------------------------------ [2008-07-30 04:42:40] jet at synth-tec dot com I am having the same problem. If an attribute has an extra quote in it, will cut off all the text afterwards. Example Input: ---------------- strip_tags(' text before link <a href="http://google.com"">google.com</a> text after link test 1 test 2 ') Expected Output: ----------------- text before link text after link test 1 test 2 Actual Output: -------------- text before link Note, I do not have this problem in PHP 5.0.4 or previous versions ------------------------------------------------------------------------ [2008-07-22 23:37:57] david at grudl dot com Description: ------------ Problematic backslash in HTML attribute (bug exists since PHP 5.2.2) Reproduce code: --------------- 1) echo strip_tags('Hello <a href="any\\"> World'); 2) this case is not HTML valid, but who cares... echo strip_tags('Hello <a href=\"any"> World'); Expected result: ---------------- Hello World (in both cases) Actual result: -------------- Hello (in both cases) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45599&edit=1