Fixed bug #21453 (improper handling of non-terminated <).

This commit is contained in:
Ilia Alshanetsky 2003-01-06 22:13:03 +00:00
parent 15f7c2c332
commit 97dd1e8abf
2 changed files with 22 additions and 0 deletions

View File

@ -3413,6 +3413,9 @@ PHPAPI void php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int
while (i < len) {
switch (c) {
case '<':
if (isspace(*(p + 1))) {
goto reg_char;
}
if (state == 0) {
lc = '<';
state = 1;
@ -3552,6 +3555,7 @@ PHPAPI void php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int
/* fall-through */
default:
reg_char:
if (state == 0) {
*(rp++) = c;
} else if (allow && state == 1) {

View File

@ -0,0 +1,18 @@
--TEST--
Bug #21453 (handling of non-encoded <)
--FILE--
<?php
$test = "
<table>
<tr><td>first cell before < first cell after</td></tr>
<tr><td>second cell before < second cell after</td></tr>
</table>";
var_dump(strip_tags($test));
?>
--EXPECT--
string(80) "
first cell before < first cell after
second cell before < second cell after
"