Added test case for the bug
state = 3;
lc = c;
} else {
- *(rp++) = c;
- }
+ if (state == 0) {
+ *(rp++) = c;
+ } else if (allow && state == 1) {
+ *(tp++) = c;
+ if ( (tp-tbuf) >= PHP_TAG_BUF_SIZE ) {
+ /* prevent buffer overflows */
+ tp = tbuf;
+ }
+ }
+ }
break;
case '?':
--- /dev/null
+--TEST--
+Bug #21744 (strip_tags misses exclamation marks in alt text)
+--FILE--
+<?php
+$test = <<< HERE
+<a href="test?test\\!!!test">test</a>
+<!-- test -->
+HERE;
+
+print strip_tags($test, '');
+print strip_tags($test, '<a>');
+?>
+--EXPECT--
+test
+<a href="test?test\!!!test">test</a>