From bbf58f92341bc31f8f274f3e9057f60675ed41a6 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Tue, 16 Nov 2010 22:16:44 +0000 Subject: [PATCH] - Fixed bug #53319 (strip_tags() may strip '
' incorrectly) --- NEWS | 1 + ext/standard/string.c | 5 ++--- ext/standard/tests/strings/bug53319.phpt | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 ext/standard/tests/strings/bug53319.phpt diff --git a/NEWS b/NEWS index 8ec41fb221..608a9d4394 100644 --- a/NEWS +++ b/NEWS @@ -66,6 +66,7 @@ - Fixed bug #53323 (pdo_firebird getAttribute() crash). (preeves at ibphoenix dot com) +- Fixed Bug #53319 (strip_tags() may strip '
' incorrectly). (Felipe) - Fixed bug #53305 (E_NOTICE when defining a constant starts with __COMPILER_HALT_OFFSET__). (Felipe) - Fixed bug #53297 (gettimeofday implementation in php/win32/time.c can return diff --git a/ext/standard/string.c b/ext/standard/string.c index 51bb611bd7..96d0ebc19d 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -4211,9 +4211,8 @@ int php_tag_find(char *tag, int len, char *set) { if (!isspace((int)c)) { if (state == 0) { state=1; - if (c != '/') - *(n++) = c; - } else { + } + if (c != '/') { *(n++) = c; } } else { diff --git a/ext/standard/tests/strings/bug53319.phpt b/ext/standard/tests/strings/bug53319.phpt new file mode 100644 index 0000000000..0bcc06d5ec --- /dev/null +++ b/ext/standard/tests/strings/bug53319.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #53319 (Strip_tags() may strip '
' incorrectly) +--FILE-- +
USD
CDN
'; +var_dump(strip_tags($str, '')); +var_dump(strip_tags($str, '
') === $str); +var_dump(strip_tags($str)); +var_dump(strip_tags('', '')); + +?> +--EXPECTF-- +string(47) "USDCDN" +bool(true) +string(6) "USDCDN" +string(0) "" -- 2.40.0