cvs: php4 /ext/standard string.c /ext/standard/tests/strings bug22008.phpt
| From: | Moriyoshi Koizumi | Date: | Sun, 04 May 2003 12:44:36 +0000 |
| Subject: | cvs: php4 /ext/standard string.c /ext/standard/tests/strings bug22008.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20675@lists.php.net to get a copy of this message | ||
moriyoshi Sun May 4 08:44:36 2003 EDT
Added files:
/php4/ext/standard/tests/strings bug22008.phpt
Modified files:
/php4/ext/standard string.c
Log:
Real fix and a test case for bug #22008
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.378 php4/ext/standard/string.c:1.379
--- php4/ext/standard/string.c:1.378 Sun May 4 07:45:58 2003
+++ php4/ext/standard/string.c Sun May 4 08:44:35 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.378 2003/05/04 11:45:58 moriyoshi Exp $ */
+/* $Id: string.c,v 1.379 2003/05/04 12:44:35 moriyoshi Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -3847,11 +3847,18 @@
}
break;
- case 3: /* JavaScript/CSS/etc... */
+ case 3:
state = 0;
tp = tbuf;
break;
-
+
+ case 4: /* JavaScript/CSS/etc... */
+ if (p >= buf + 2 && *(p-1) == '-' && *(p-2) == '-') {
+ state = 0;
+ tp = tbuf;
+ }
+ break;
+
default:
*(rp++) = c;
break;
@@ -3888,6 +3895,12 @@
tp = tbuf;
}
}
+ }
+ break;
+
+ case '-':
+ if (state == 3 && p >= buf + 2 && *(p-1) == '-' && *(p-2)
== '!') {
+ state = 4;
}
break;
Index: php4/ext/standard/tests/strings/bug22008.phpt
+++ php4/ext/standard/tests/strings/bug22008.phpt
--TEST--
Bug #22008 (strip_tags() eliminates too much)
--FILE--
<?php
$html = <<< HERE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>test</title>
</head>
<body>
<b>PHP!</b>
</body>
</html>
HERE;
echo trim(strip_tags($html, '<b>'))."\n";
?>
--EXPECT--
test
<b>PHP!</b>