felipe                                   Tue, 16 Nov 2010 22:16:44 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=305418

Log:
- Fixed bug #53319 (strip_tags() may strip '<br />' incorrectly)

Bug: http://bugs.php.net/53319 (Open) Strip_tags() may strip '<br />' 
incorrectly
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/standard/string.c
    A   php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug53319.phpt
    U   php/php-src/trunk/ext/standard/string.c
    A   php/php-src/trunk/ext/standard/tests/strings/bug53319.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-11-16 22:02:36 UTC (rev 305417)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-11-16 22:16:44 UTC (rev 305418)
@@ -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

Modified: php/php-src/branches/PHP_5_3/ext/standard/string.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/string.c  2010-11-16 22:02:36 UTC 
(rev 305417)
+++ php/php-src/branches/PHP_5_3/ext/standard/string.c  2010-11-16 22:16:44 UTC 
(rev 305418)
@@ -4211,9 +4211,8 @@
                                if (!isspace((int)c)) {
                                        if (state == 0) {
                                                state=1;
-                                               if (c != '/')
-                                                       *(n++) = c;
-                                       } else {
+                                       }
+                                       if (c != '/') {
                                                *(n++) = c;
                                        }
                                } else {

Added: php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug53319.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug53319.phpt       
                        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug53319.phpt       
2010-11-16 22:16:44 UTC (rev 305418)
@@ -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) ""


Property changes on: 
php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug53319.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/trunk/ext/standard/string.c
===================================================================
--- php/php-src/trunk/ext/standard/string.c     2010-11-16 22:02:36 UTC (rev 
305417)
+++ php/php-src/trunk/ext/standard/string.c     2010-11-16 22:16:44 UTC (rev 
305418)
@@ -4210,9 +4210,8 @@
                                if (!isspace((int)c)) {
                                        if (state == 0) {
                                                state=1;
-                                               if (c != '/')
-                                                       *(n++) = c;
-                                       } else {
+                                       }
+                                       if (c != '/') {
                                                *(n++) = c;
                                        }
                                } else {

Added: php/php-src/trunk/ext/standard/tests/strings/bug53319.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/strings/bug53319.phpt                  
        (rev 0)
+++ php/php-src/trunk/ext/standard/tests/strings/bug53319.phpt  2010-11-16 
22:16:44 UTC (rev 305418)
@@ -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) ""


Property changes on: php/php-src/trunk/ext/standard/tests/strings/bug53319.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to