Patch files for php 5.x and 6 with a test.
-- Herman Radtke hermanrad...@gmail.com | http://hermanradtke.com
Index: ext/standard/string.c =================================================================== --- ext/standard/string.c (revision 284189) +++ ext/standard/string.c (working copy) @@ -4367,7 +4367,7 @@ tp = ((tp-tbuf) >= PHP_TAG_BUF_SIZE ? tbuf: tp); *(tp++) = c; } - if (state && p != buf && *(p-1) != '\\' && (!in_q || *p == in_q)) { + if (state && p != buf && (state == 1 || *(p-1) != '\\') && (!in_q || *p == in_q)) { if (in_q) { in_q = 0; } else {
Index: ext/standard/string.c =================================================================== --- ext/standard/string.c (revision 284189) +++ ext/standard/string.c (working copy) @@ -6519,7 +6519,7 @@ tp = ((tp-tbuf) >= UBYTES(PHP_TAG_BUF_SIZE) ? tbuf: tp); *(tp++) = ch; } - if (state && prev1 != 0x5C /*'\\'*/ && (!in_q || ch == in_q)) { + if (state && (state ==1 || prev1 != 0x5C /*'\\'*/) && (!in_q || ch == in_q)) { if (in_q) { in_q = 0; } else { @@ -6763,7 +6763,7 @@ tp = ((tp-tbuf) >= PHP_TAG_BUF_SIZE ? tbuf: tp); *(tp++) = c; } - if (state && p != buf && *(p-1) != '\\' && (!in_q || *p == in_q)) { + if (state && p != buf && (state ==1 || *(p-1) != '\\') && (!in_q || *p == in_q)) { if (in_q) { in_q = 0; } else {
--TEST-- Bug #45599 (strip_tags() ignore backslash (\) character inside html tags) --FILE-- <?php echo strip_tags('Hello <a href="any\"> World') . "\n"; echo strip_tags('Hello <a href="any\\"> World') . "\n"; echo strip_tags('Hello <a href=\"any"> World'); ?> --EXPECT-- Hello World Hello World Hello World
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php