]> granicus.if.org Git - php/commitdiff
- Fixed bug #53319 (strip_tags() may strip '<br />' incorrectly)
authorFelipe Pena <felipe@php.net>
Tue, 16 Nov 2010 22:16:44 +0000 (22:16 +0000)
committerFelipe Pena <felipe@php.net>
Tue, 16 Nov 2010 22:16:44 +0000 (22:16 +0000)
NEWS
ext/standard/string.c
ext/standard/tests/strings/bug53319.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 8ec41fb2214fff83bbdb72c51846736d15bf13e2..608a9d4394838d45eb4b8481875f7ee0f1178b52 100644 (file)
--- 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 '<br />' 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
index 51bb611bd7776dd058356bb15ff370ca1644dd01..96d0ebc19d9f9ca8904db00fd9276289d0ee9436 100644 (file)
@@ -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 (file)
index 0000000..0bcc06d
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Bug #53319 (Strip_tags() may strip '<br />' incorrectly)
+--FILE--
+<?php
+
+$str = '<br /><br  />USD<input type="text"/><br/>CDN<br><input type="text" />';
+var_dump(strip_tags($str, '<input>'));
+var_dump(strip_tags($str, '<br><input>') === $str);
+var_dump(strip_tags($str));
+var_dump(strip_tags('<a/b>', '<a>'));
+
+?>
+--EXPECTF--
+string(47) "USD<input type="text"/>CDN<input type="text" />"
+bool(true)
+string(6) "USDCDN"
+string(0) ""