Opened 3 years ago
Last modified 7 months ago
#51019 new defect (bug)
convert_smilies() fails on large tags
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.5 |
Component: | Formatting | Keywords: | has-patch |
Focuses: | Cc: |
Description
I have an image with huge data-url src (1.6M) in the post content.
The post content is not displayed, but (with WP_DEBUG
on) there is a php error instead.
PHP Error output:
Warning: count(): Parameter must be an array or an object that implements Countable in /Users/joern/www/vhosts/wordpress.local/httpdocs/stable/wp-includes/formatting.php on line 3357
Som digging revealed, that preg_split()
in function convert_smilies()
fails with a PREG_RECURSION_LIMIT_ERROR
.
IMHO there should a check for preg_last_error()
whether preg_split()
was successfull, and if not the function should just return its input.
Any thoughts on this?
I'd be happy to craft a patch.
Change History (7)
This ticket was mentioned in PR #792 on WordPress/wordpress-develop by nathkrill.
2 years ago
#2
- Keywords has-patch added; needs-patch removed
…o avoid issues in ticket #51019
Use preg_last_error() inside convert_smilies() to check for any preg_split errors before running count().
If there are errors, sends a PHP warning with the error message, then returns the original text.
Running count() on the array after there are preg_split errors can cause post content to not display (see ticket).
Trac ticket: https://core.trac.wordpress.org/ticket/51019
github-actions[bot] commented on PR #792:
2 years ago
#3
Hi @nathkrill! 👋
Thank you for your contribution to WordPress! 💖
It looks like this is your first pull request to wordpress-develop
. Here are a few things to be aware of that may help you out!
No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description.
Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making.
More information about how GitHub pull requests can be used to contribute to WordPress can be found in this blog post.
Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook.
If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook.
The Developer Hub also documents the various coding standards that are followed:
- PHP Coding Standards
- CSS Coding Standards
- HTML Coding Standards
- JavaScript Coding Standards
- Accessibility Coding Standards
- Inline Documentation Standards
Thank you,
The WordPress Project
This ticket was mentioned in PR #1124 on WordPress/wordpress-develop by nathkrill.
2 years ago
#4
Use preg_last_error() inside convert_smilies() to check for any preg_split errors before running count().
If there are errors, sends a PHP warning with the error message, then returns the original text.
Running count() on the array after there are preg_split errors can cause post content to not display (see ticket).
This is a reformat of a previous pull request to get the PHP tests to pass.
Trac ticket: https://core.trac.wordpress.org/ticket/51019
borzaszto commented on PR #1124:
15 months ago
#5
Same, +1 Up 🙌
lzudor-omnitech commented on PR #1124:
15 months ago
#6
Is there any ETA on this..?
#7
@
7 months ago
FWIW I'd probably just check $textarr === false rather than preg_last_error(), but looks good to me.
Another report on WPSE: https://wordpress.stackexchange.com/q/409084
Hi there, welcome back to WordPress Trac! Thanks for the ticket.
Makes sense to me :)