summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2008-07-11 12:16:06 +0000
committerFelipe Pena <felipe@php.net>2008-07-11 12:16:06 +0000
commitfc2cf6e19f6085b286a3f0ba672cca7b3311f19e (patch)
treef319cedfdacca92ac91e07d2ec9f6d11dc44e202 /ext
parentb2f1de8924a015a850af5ceecefff9089b5d7a71 (diff)
downloadphp-git-fc2cf6e19f6085b286a3f0ba672cca7b3311f19e.tar.gz
- Fixed bug #45485 (strip_tags and <?XML tag)
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/string.c3
-rw-r--r--ext/standard/tests/strings/bug45485.phpt23
2 files changed, 25 insertions, 1 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index f4bb26005d..54f680a00d 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -4519,12 +4519,13 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, int len, int *stateptr, char *allow,
/* fall-through */
case 'l':
+ case 'L':
/* swm: If we encounter '<?xml' then we shouldn't be in
* state == 2 (PHP). Switch back to HTML.
*/
- if (state == 2 && p > buf+2 && *(p-1) == 'm' && *(p-2) == 'x') {
+ if (state == 2 && p > buf+2 && strncasecmp(p-2, "xm", 2) == 0) {
state = 1;
break;
}
diff --git a/ext/standard/tests/strings/bug45485.phpt b/ext/standard/tests/strings/bug45485.phpt
new file mode 100644
index 0000000000..4d24c9ad87
--- /dev/null
+++ b/ext/standard/tests/strings/bug45485.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #45485 (strip_tags and <?XML tag)
+--FILE--
+<?php
+
+$s =<<< EOD
+This text is shown <?XML:NAMESPACE PREFIX = ST1 /><b>This Text disappears</b>
+EOD;
+
+$s = strip_tags($s);
+echo htmlspecialchars($s),"\n";
+
+$s =<<< EOD
+This text is shown <?xml:NAMESPACE PREFIX = ST1 /><b>This Text disappears</b>
+EOD;
+
+$s = strip_tags($s);
+echo htmlspecialchars($s),"\n";
+
+?>
+--EXPECT--
+This text is shown This Text disappears
+This text is shown This Text disappears