summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2019-05-13 13:10:24 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2019-05-13 13:10:24 +0200
commit69bab6e5a5c8afba684b5fbde6e005a47408d01e (patch)
treea11f048e473e11bb44b7fa45c6fffd8abafab677
parentbec68d59a2ada17768d47c708eda52adc491e615 (diff)
downloadphp-git-69bab6e5a5c8afba684b5fbde6e005a47408d01e.tar.gz
Fix #78003: strip_tags output change since PHP 7.3
A refactoring of the strip tags state machine[1] missed the special treatment of `depth > 0` when a `>` is encountered in state 2 or 3. We re-add it for BC reasons. [1] <http://git.php.net/?p=php-src.git;a=commit;h=5cf64742773ddbf9af69d962a4d12b567fcf0084>
-rw-r--r--NEWS1
-rw-r--r--ext/standard/string.c8
-rw-r--r--ext/standard/tests/strings/bug78003.phpt16
3 files changed, 25 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 56b423a5f3..98c06eb5d1 100644
--- a/NEWS
+++ b/NEWS
@@ -35,6 +35,7 @@ PHP NEWS
- Standard:
. Fixed bug #77931 (Warning for array_map mentions wrong type). (Nikita)
+ . Fixed bug #78003 (strip_tags output change since PHP 7.3). (cmb)
02 May 2019, PHP 7.3.5
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 7404f38982..fe7f64de2e 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -5227,6 +5227,10 @@ state_2:
}
break;
case '>':
+ if (depth) {
+ depth--;
+ break;
+ }
if (in_q) {
break;
}
@@ -5284,6 +5288,10 @@ state_3:
c = *p;
switch (c) {
case '>':
+ if (depth) {
+ depth--;
+ break;
+ }
if (in_q) {
break;
}
diff --git a/ext/standard/tests/strings/bug78003.phpt b/ext/standard/tests/strings/bug78003.phpt
new file mode 100644
index 0000000000..4379ca8a71
--- /dev/null
+++ b/ext/standard/tests/strings/bug78003.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #78003 (strip_tags output change since PHP 7.3)
+--FILE--
+<?php
+var_dump(
+ strip_tags('<foo<>bar>'),
+ strip_tags('<foo<!>bar>'),
+ strip_tags('<foo<?>bar>')
+);
+?>
+===DONE===
+--EXPECT--
+string(0) ""
+string(0) ""
+string(0) ""
+===DONE===