From: Ilia Alshanetsky Date: Fri, 20 Sep 2002 11:48:47 +0000 (+0000) Subject: Fixed bugs #12989 and #12120 X-Git-Tag: MODERN_SYMMETRIC_SESSION_BEHAVIOUR_20021003~271 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bc8eda53855cc0272c758d28433e06e3f69b491a;p=php Fixed bugs #12989 and #12120 --- diff --git a/ext/standard/string.c b/ext/standard/string.c index 9479c6948e..82f19c1bd5 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -3324,7 +3324,7 @@ int php_tag_find(char *tag, int len, char *set) { PHPAPI void php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int allow_len) { char *tbuf, *buf, *p, *tp, *rp, c, lc; - int br, i=0; + int br, i=0, depth=0; int state = 0; if (stateptr) @@ -3353,6 +3353,8 @@ PHPAPI void php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int if(allow) { *(tp++) = '<'; } + } else if (state) { + depth++; } break; @@ -3383,6 +3385,11 @@ PHPAPI void php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int break; case '>': + if (depth) { + depth--; + break; + } + if (state == 1) { lc = '>'; state = 0;