diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2019-08-02 17:03:20 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2019-08-02 17:03:20 +0200 |
commit | a87ef5e3ddfdb3083c2b62bb25835b74d9a3d083 (patch) | |
tree | b602d6b043a6994c3d3c4ba1a6304ae042644e4b /ext | |
parent | 81efd489db387a6ab3c9bcafdfd65e304cf2ab08 (diff) | |
download | php-git-a87ef5e3ddfdb3083c2b62bb25835b74d9a3d083.tar.gz |
Fix #78346: strip_tags no longer handling nested php tags
When the strip tags state machine has been flattened, an if statement
has mistakenly been treated as else if. We fix this, and also simplify
a bit right away.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/standard/string.c | 3 | ||||
-rw-r--r-- | ext/standard/tests/strings/bug78346.phpt | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c index 6ed6ec2a50..dde97faf4d 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5271,8 +5271,7 @@ state_2: } else if (lc != '\\') { lc = c; } - } else { - if (p != buf && *(p-1) != '\\' && (!in_q || *p == in_q)) { + if (p != buf && (!in_q || *p == in_q)) { if (in_q) { in_q = 0; } else { diff --git a/ext/standard/tests/strings/bug78346.phpt b/ext/standard/tests/strings/bug78346.phpt new file mode 100644 index 0000000000..f2c508f09b --- /dev/null +++ b/ext/standard/tests/strings/bug78346.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #78346 (strip_tags no longer handling nested php tags) +--FILE-- +<?php +$str = '<?= \'<?= 1 ?>\' ?>2'; +var_dump(strip_tags($str)); +?> +--EXPECT-- +string(1) "2" |