New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for infinite loops in post.excerpt in specific cases #2972
Conversation
…ed in WP 5.0 and we require at least 5.3
@gchtr , I reverted the parameters to the old ones. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me 👍.
I’m not a huge fan of adding the $remove_blocks
flag as an additional parameter, though. But I can’t think of anything better at the moment.
@nlemoine Anything to add here?
I had the same feeling, Ideally you would want to know what the caller is of the |
Using Sorry, I didn't dig that topic much, I trust you guys on this 👍 |
Related:
Issue
When you render a post preview in a dynamic block this will cause an infinite loop.
Solution
When fetching the content from the excerpt method, run the
excerpt_remove_blocks
function inside thecontent()
method.Impact
Post previews will probably render faster since now we are not parsing blocks anymore.
Usage Changes
I added a third parameter to the
content()
method but this is optional.Considerations
Nothing I can think about right now.
Testing
Test and additional assets added to register a block, render the block via a render callback and then run a post.preview inside it. if you remove the suggested changes in Post.php and run the test it will cause a timeout which shows up in PHPunit as a segmentation fault.