From b4c18745d9db74d288d48bf8a2a19a3c5d5ca3d2 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Tue, 22 Dec 2009 02:04:12 +0000 Subject: [PATCH] Fixed bug #45599 (strip_tags() truncates rest of string with invalid attribute). --- NEWS | 3 ++- ext/standard/string.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index d1a016ca6e..e1d97cfeb9 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,8 @@ PHP NEWS (Jani) - Fixed bug #50394 (Reference argument converted to value in __call). (Stas) - Fixed bug #49851 (http wrapper breaks on 1024 char long headers). (Ilia) - +- Fixed bug #45599 (strip_tags() truncates rest of string with invalid + attribute). (Ilia, hradtke) 17 Dec 2009, PHP 5.2.12 - Updated timezone database to version 2009.19 (2009s). (Derick) diff --git a/ext/standard/string.c b/ext/standard/string.c index 87c6d94216..fa8fcd2a1d 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -4470,7 +4470,7 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, int len, int *stateptr, char *allow, 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 { -- 2.40.0