felipe          Fri Nov 21 19:14:47 2008 UTC

  Added files:                 
    /php-src/ext/standard/tests/strings bug46578.phpt 

  Modified files:              
    /php-src/ext/standard       string.c 
  Log:
  - Fixed bug #46578 (strip_tags() does not honor end-of-comment when it 
encounters a single quote)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.683&r2=1.684&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.683 php-src/ext/standard/string.c:1.684
--- php-src/ext/standard/string.c:1.683 Tue Oct 21 22:06:48 2008
+++ php-src/ext/standard/string.c       Fri Nov 21 19:14:46 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.683 2008/10/21 22:06:48 lbarnaud Exp $ */
+/* $Id: string.c,v 1.684 2008/11/21 19:14:46 felipe Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6538,7 +6538,10 @@
 
                case 0x22: /* '"' */
                case 0x27: /* '\'' */
-                       if (state == 2 && prev1 != 0x5C) { /* '\\' */
+                       if (state == 4){
+                               /* Inside <!-- comment --> */
+                               break;
+                       } else if (state == 2 && prev1 != 0x5C) { /* '\\' */
                                if (last == ch) {
                                        last = 0x00;
                                } else if (last != 0x5C) {
@@ -6779,7 +6782,10 @@
 
                        case '"':
                        case '\'':
-                               if (state == 2 && *(p-1) != '\\') {
+                               if (state == 4) {
+                                       /* Inside <!-- comment --> */
+                                       break;
+                               } else if (state == 2 && *(p-1) != '\\') {
                                        if (lc == c) {
                                                lc = '\0';
                                        } else if (lc != '\\') {

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug46578.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/bug46578.phpt
+++ php-src/ext/standard/tests/strings/bug46578.phpt
--TEST--
Bug #46578 (strip_tags() does not honor end-of-comment when it encounters a 
single quote)
--FILE--
<?php

var_dump(strip_tags('<!-- testing I\'ve been to mars -->foobar'));

var_dump(strip_tags('<a alt="foobar">foo<!-- foo! --></a>bar'));

var_dump(strip_tags('<a alt="foobar"/>foo<?= foo! /* <!-- "cool" --> */ 
?>bar'));

var_dump(strip_tags('< ax'));

var_dump(strip_tags('<! a>'));

var_dump(strip_tags('<? ax'));

?>
--EXPECTF--
%string|unicode%(6) "foobar"
%string|unicode%(6) "foobar"
%string|unicode%(6) "foobar"
%string|unicode%(4) "< ax"
%string|unicode%(0) ""
%string|unicode%(0) ""



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

Reply via email to