com php-src: Fix #78003: strip_tags output change since PHP 7.3: NEWS ext/standard/string.c ext/st andard/tests/strings/bug78003.phpt
| From: | Christoph Michael Becker | Date: | Mon, 13 May 2019 11:10:24 +0000 |
| Subject: | com php-src: Fix #78003: strip_tags output change since PHP 7.3: NEWS ext/standard/string.c ext/st andard/tests/strings/bug78003.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106162@lists.php.net to get a copy of this message | ||
Commit: 69bab6e5a5c8afba684b5fbde6e005a47408d01e
Author: Christoph M. Becker <cmbecker69@gmx.de> Mon, 13 May 2019 13:10:24 +0200
Parents: bec68d59a2ada17768d47c708eda52adc491e615
Branches: PHP-7.3 PHP-7..4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=69bab6e5a5c8afba684b5fbde6e005a47408d01e
Log:
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>
Bugs:
https://bugs.php.net/78003
Changed paths:
M NEWS
M ext/standard/string.c
A ext/standard/tests/strings/bug78003.phpt
Diff:
diff --git a/NEWS b/NEWS
index 56b423a..98c06eb 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 7404f38..fe7f64d 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 0000000..4379ca8
--- /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===