summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2002-12-31 15:18:52 +0000
committerRasmus Lerdorf <rasmus@php.net>2002-12-31 15:18:52 +0000
commitf88e29bc0d1369de0b0a18c73ff39cc7d3a5bf87 (patch)
tree6cfc1073b92517a4c57afead0cfda3edb5c60eed
parentabc4b4bb99d998a57b8a4f9ab6edfefcd6130b60 (diff)
downloadphp-git-f88e29bc0d1369de0b0a18c73ff39cc7d3a5bf87.tar.gz
Fix for bug #21311
-rw-r--r--ext/standard/string.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index d5defdc253..3626034cfd 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -3509,11 +3509,12 @@ PHPAPI void php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int
/* JavaScript & Other HTML scripting languages */
if (state == 1 && *(p-1) == '<') {
state = 3;
+ lc = c;
} else {
*(rp++) = c;
}
break;
-
+
case '?':
if (state == 1 && *(p-1)=='<') {
@@ -3522,13 +3523,28 @@ PHPAPI void php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int
break;
}
+ case 'E':
+ case 'e':
+ /* !DOCTYPE exception */
+ if (state==3 && p > buf+6
+ && tolower(*(p-1)) == 'p'
+ && tolower(*(p-2)) == 'y'
+ && tolower(*(p-3)) == 't'
+ && tolower(*(p-4)) == 'c'
+ && tolower(*(p-5)) == 'o'
+ && tolower(*(p-6)) == 'd') {
+ state = 1;
+ break;
+ }
+ /* fall-through */
+
case 'l':
/* swm: If we encounter '<?xml' then we shouldn't be in
* state == 2 (PHP). Switch back to HTML.
*/
- if (state == 2 && *(p-1) == 'm' && *(p-2) == 'x') {
+ if (state == 2 && p > buf+2 && *(p-1) == 'm' && *(p-2) == 'x') {
state = 1;
break;
}