Closed alexmerz closed 1 year ago
I'm not sure if this problem is also directly related to this or not: When the post also contains an embedded content that triggers the population of $this->did_replacements, then the regex does not seems to be executed at all. I was able to get around this by removing the empty( $this->did_replacements ) check in line 1295. But I'm not sure, if this is the correct way to deal with this.
Please create a separate issue for that. I couldn’t produce any actual problem with this information so far.
Bug/Problem
If a regex is used to recognize a block of embedded content, the regex and the replacement with the overlay works to "generous".
Basic example is a Post with a content like:
and the regex is defined like
Currently, the result will be, that the overlay will always display "content 1" for both embeds if the embed ist enabled. The reason is that $matches is generated only once for the type of embed block, in line 1301 in inc/class-embed-privacy.php:
and then preg_replace is applied without a limit in 1335.
I was able to fix the behavoir by:
This way, the code will iterate and replace each match individually. The fix is not perfect, as the code btween 1308 and 1334 gets repeated in this new loop without need.
I'm not sure if this problem is also directly related to this or not: When the post also contains an embedded content that triggers the population of $this->did_replacements, then the regex does not seems to be executed at all. I was able to get around this by removing the
empty( $this->did_replacements )
check in line 1295. But I'm not sure, if this is the correct way to deal with this.Steps to reproduce
Version
current main branch
Link
No response
Environment info
WP 6.1 Browser - all Win 11, Desktop
(issue is serverside
Code of Conduct