Repository navigation
Conversation
…feed items. SimplePie returns `null` from `get_link()`, `get_title()`, `get_description()` and `SimplePie\Author::get_name()` when a feed item is missing that element. `wp_widget_rss_output()` passed those values straight to `strip_tags()` and `html_entity_decode()`, which triggers "Passing null to parameter #1" deprecation notices on PHP 8.1 and later. This casts each value to a string before it is used, so the rendered output stays the same: a missing title still shows "Untitled", a missing link still renders the title without an anchor, and a missing description still gives an empty summary. Includes a second test feed with items that are missing a title, link, description or author name, to cover feeds that are not well formed. Props snehapatil2001, vishalpadhariya, peterwilsoncc, Presskopp, treibstoff, dhrupo. Fixes #61179. See #59052.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Scripts and styles in the admin and on the login screen are no longer concatenated through `load-scripts.php` and `load-styles.php`. Concatenation paid off when browsers opened few connections per host over HTTP/1.1, but it has long been a source of bugs: dependencies outside the default directories were not honored, `SCRIPT_DEBUG` and the `script_loader_src` and `style_loader_src` filters were ignored, inline styles could be duplicated, and code run by the loaders without WordPress loaded caused fatal errors. It was turned off by default in r64320, once the assets of the next admin screen began to be prefetched in r64120, and this removes what remains. Every item is now printed as its own tag, and what remains of the concatenation API is deprecated or removed: * The properties of `WP_Scripts` and `WP_Styles` that held items back for concatenation are deprecated but still declared, so plugins reading or setting them keep working. The `do_item()` methods no longer check `do_concat`. * The `_print_scripts()`, `_print_styles()`, `script_concat_settings()`, `in_default_dir()` and `WP_Dependencies::get_etag()` functions are deprecated. * The `print_head_scripts`, `print_footer_scripts`, `print_admin_styles` and `print_late_styles` filters only decided whether held markup was printed, so they are applied with `apply_filters_deprecated()` and their return values are ignored. * The `CONCATENATE_SCRIPTS` constant is no longer read. * The `wp_should_concatenate_admin_scripts()` function and its filter, added in r64120 for the transition and never released, are removed. The loaders now respond with 410 Gone and a one-line plain text explanation, without loading WordPress, so that requests from bots and stale links cost next to nothing. Code written to run inside them without WordPress loaded, such as `wp_theme_has_theme_json()`, now uses the functions it had avoided, and `wp-admin/includes/noop.php` no longer defines its stub functions. Developed in WordPress#14463. Follow-up to r10357, r43580, r60719, r62657, r64120, r64320, r64485. Props westonruter, jonsurrell, peterwilsoncc, azaozz, markhowellsmead, sergiomdgomes, jerclarke, adamsilverstein, sukhendu2002, adnan007, momo360modena, desrosj, welcher. See WordPress#15833, #36448, #36449, #36779, #43825, #45008, #47322, #52879, #63908, #64087, #65515. Fixes #57548. git-svn-id: https://develop.svn.wordpress.org/trunk@64585 602fd350-edb4-49c9-b593-d223f7449a82
Scripts and styles in the admin and on the login screen are no longer concatenated through `load-scripts.php` and `load-styles.php`. Concatenation paid off when browsers opened few connections per host over HTTP/1.1, but it has long been a source of bugs: dependencies outside the default directories were not honored, `SCRIPT_DEBUG` and the `script_loader_src` and `style_loader_src` filters were ignored, inline styles could be duplicated, and code run by the loaders without WordPress loaded caused fatal errors. It was turned off by default in r64320, once the assets of the next admin screen began to be prefetched in r64120, and this removes what remains. Every item is now printed as its own tag, and what remains of the concatenation API is deprecated or removed: * The properties of `WP_Scripts` and `WP_Styles` that held items back for concatenation are deprecated but still declared, so plugins reading or setting them keep working. The `do_item()` methods no longer check `do_concat`. * The `_print_scripts()`, `_print_styles()`, `script_concat_settings()`, `in_default_dir()` and `WP_Dependencies::get_etag()` functions are deprecated. * The `print_head_scripts`, `print_footer_scripts`, `print_admin_styles` and `print_late_styles` filters only decided whether held markup was printed, so they are applied with `apply_filters_deprecated()` and their return values are ignored. * The `CONCATENATE_SCRIPTS` constant is no longer read. * The `wp_should_concatenate_admin_scripts()` function and its filter, added in r64120 for the transition and never released, are removed. The loaders now respond with 410 Gone and a one-line plain text explanation, without loading WordPress, so that requests from bots and stale links cost next to nothing. Code written to run inside them without WordPress loaded, such as `wp_theme_has_theme_json()`, now uses the functions it had avoided, and `wp-admin/includes/noop.php` no longer defines its stub functions. Developed in WordPress#14463. Follow-up to r10357, r43580, r60719, r62657, r64120, r64320, r64485. Props westonruter, jonsurrell, peterwilsoncc, azaozz, markhowellsmead, sergiomdgomes, jerclarke, adamsilverstein, sukhendu2002, adnan007, momo360modena, desrosj, welcher. See WordPress#15833, #36448, #36449, #36779, #43825, #45008, #47322, #52879, #63908, #64087, #65515. Fixes #57548. git-svn-id: https://develop.svn.wordpress.org/trunk@64585 602fd350-edb4-49c9-b593-d223f7449a82
Trac ticket: https://core.trac.wordpress.org/ticket/61179
Summary
wp_widget_rss_output()passes SimplePie item values straight tostrip_tags()andhtml_entity_decode(). SimplePie returnsnullwhen an item has no<link>,<title>or<description>, andSimplePie\Author::get_name()returnsnullfor an RSS<author>that holds only an email address. On PHP 8.1 and later each of these logs "Passing null to parameter #1 ($string) of type string is deprecated".This PR builds on #6826 by snehapatil2001 and the
59052.patchby vishalpadhariya on https://core.trac.wordpress.org/ticket/59052. Both guard only the description. As requested in https://core.trac.wordpress.org/ticket/61179#comment:7, this also covers missing titles and links (and author names), and adds a second test feed for items that are not well formed.The change casts the four values to strings where they are read. The rendered output does not change:
<cite></cite>.Note for review: #9042 (https://core.trac.wordpress.org/ticket/63611) edits the same title line to add
html_entity_decode(). Whichever lands second needs a one-line rebase there, and that call also needs the(string)cast.Testing
New fixture
tests/phpunit/data/feed/rss-incomplete-items.xmlwith one complete item and items missing a title, link, description or author name. The new test renders it throughwp_widget_rss_output()with summary, author and date on, and asserts the full HTML output.Before the change (trunk), PHP 8.5:
Removing each cast on its own makes the test fail at that spot (lines 1656, 1658, 1663 and 1692). On trunk with PHP 7.4 the same test passes, which shows the expected HTML matches the current output.
After the change:
Manual test in WordPress Playground (PHP 8.5,
WP_DEBUG_LOGon), rendering an RSS widget for the same feed on the front end:Use of AI Tools
Claude Code was used to refresh the patch and write the tests; I reviewed and tested everything myself.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.