[58335] introduced `(string)` type casting of the passed in `$comment_id` value. If `$comment_id` is a scalar, it works as expected. But if it's an `object`, the following fatal error is thrown:
{{{
Object of class WP_Comment could not be converted to string
}}}
This fatal error happens when the incoming `$comment_id` is an instance of `WP_Comment` (or any object) without a `comment_ID` (empty).
This changeset adds tests to demonstrate the fatal error and validate the fix.
It fixes the fatal error by restructuring the ternary checks into an `if/elseif/else` structure for the 3 paths:
- When `$comment->comment_ID` is not empty, then it uses the property.
- When `$comment_id` is scalar, then it type casts it to a `string`.
- Else, the default is an empty `string`.
Follow-up to [58335], [41127], [52818].
Props ambrosiawt, hellofromTonya, jorbin, mukesh27, SergeyBiryukov.
Fixes#61681.
Built from https://develop.svn.wordpress.org/trunk@58755
git-svn-id: http://core.svn.wordpress.org/trunk@58157 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prior to WordPress 6.4, performance testing was performed using Puppeteer instead of Playwright (converted in [56926]). Because of the flaky nature of the workflow using Puppeteer, it was not converted to the reusable pattern implemented through #61213. It was instead removed from 6.2 and 6.3 in [58301] and [58330], respectively.
This removes the workflow for these branches from the strategy matrix when testing old branches to avoid errors and adds an expanded note about why those branches are missing.
See #61213, #61564.
Built from https://develop.svn.wordpress.org/trunk@58754
git-svn-id: http://core.svn.wordpress.org/trunk@58156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Following [58215], admin bar items in the `top-secondary` group have a changed visual order. Increase the priority of the user and recovery menu items so nodes added with higher priorities will still be shown visually before the user and recovery menu items, as they were prior to 58215.
The items will appear in the reverse of the previous order, but the new order now matches their priority order, rather than being the opposite.
Props sabernhardt, joemcgill, pbiron, joedolson.
Fixes#61615.
Built from https://develop.svn.wordpress.org/trunk@58748
git-svn-id: http://core.svn.wordpress.org/trunk@58150 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The CSS to make menu item containers resizable in the admin menu editor was too broadly scoped, and caused classic editor metaboxes to have unconstrained height. Limit the scope of the CSS changes to only impact menu item containers.
Props neotrope, sabernhardt, joedolson.
Fixes#61662.
Built from https://develop.svn.wordpress.org/trunk@58747
git-svn-id: http://core.svn.wordpress.org/trunk@58149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In part of a larger review of CSS semantics and behaviors, this patch
takes the opportunity to remove leading whitespace in an updated class
attribute after the first class in the attribute has been removed.
Previously, if the first class name had been removed, the whitespace
that formerly followed it would remain in the class attribute. This
stood in contrast to removing other class names, which removed their
associated whitespace.
There should be no semantic or functional changes in this patch, only
a slightly-large diff for modified HTML documents that looks prettier
when removing the first class name in a class attribute.
Developed in https://github.com/WordPress/wordpress-develop/pull/6933
Discussed in https://core.trac.wordpress.org/ticket/61531
Props dmsnell, jonsurrell.
See #61531.
Built from https://develop.svn.wordpress.org/trunk@58740
git-svn-id: http://core.svn.wordpress.org/trunk@58142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Refactors the following tests to use a data provider with named test cases:
* `test_wp_interactivity_data_wp_context_with_different_arrays()`
* `test_wp_interactivity_data_wp_context_with_different_arrays_and_a_namespace()`
* `test_wp_interactivity_data_wp_context_with_json_flags()`
This is better as:
1. One failing test will not block the other tests from running.
2. Each test is now referenced by name in any error message, making it more straight forward to see which test failed.
3. The test no longer contains multiple assertions.
3. It makes it more straight forward to add additional tests.
Follow-up to [58594], [58234], [57762], [57743], [57742], [57563].
Props jrf.
See #61530.
Built from https://develop.svn.wordpress.org/trunk@58739
git-svn-id: http://core.svn.wordpress.org/trunk@58141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Once the `test_process_directives_when_block_is_filtered()` method has run, the named `test_render_block_data()` function declared nested within becomes part of the global namespace, which could cause problems for other tests.
Quite apart from the fact that the name starting with `test_` is confusing (as methods prefixed with `test_` are supposed to be test methods to be run by PHPUnit).
Using a closure for this callback fixes the issue. Declared as `static` for a micro-optimization.
Follow-up to [57826].
Props jrf, hellofromTonya.
See #61530.
Built from https://develop.svn.wordpress.org/trunk@58738
git-svn-id: http://core.svn.wordpress.org/trunk@58140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Changeset [58712] introduced the following compile time PHP deprecation notice on >= PHP 8.2 test runs:
{{{
Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /var/www/tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php on line 257
PHPUnit 9.6.20 by Sebastian Bergmann and contributors.
}}}
The `${` syntax for string interpolation was deprecated in PHP 8.2 and should not be used anymore.
Ref: https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation
Follow-up to [58712].
Props jrf.
See #61530, #59654, #61576.
Built from https://develop.svn.wordpress.org/trunk@58733
git-svn-id: http://core.svn.wordpress.org/trunk@58135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The font family was not showing correctly for the verse block. The approach taken was to match the front end and this involved also removing the styles in [50358].
Props pranitdugad, sabernhardt, poena, pitamdey.
Fixes#61140.
Built from https://develop.svn.wordpress.org/trunk@58731
git-svn-id: http://core.svn.wordpress.org/trunk@58133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The border was not changing color when it was changed. This brings that in. It is worth noting the original theme design did not have this but as noted in the ticket this has been in the quote block for about two years so matching the current block styling in this case makes sense.
Props umesh84, desrosj, sabernhardt.
Fixes#56565.
Built from https://develop.svn.wordpress.org/trunk@58728
git-svn-id: http://core.svn.wordpress.org/trunk@58130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The button block had issues with font styling not applying. This not only brings letter-spacing but also line-height, text-transform and font-weight to wp-button-block-buttons. [57300] fixed the separator issue. This fix also added box-shadow none for consistency.
Props darshitrajyaguru97, harshgajipara, shailu25, sabernhardt, alvitazwar052.
Fixes#58609.
Built from https://develop.svn.wordpress.org/trunk@58725
git-svn-id: http://core.svn.wordpress.org/trunk@58127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `$single` parameter is passed via the `get_post_metadata` filter and has no default value.
Includes minor code layout fixes for consistency with the formatting of other long conditionals in core.
Follow-up to [56714].
Props rodrigosprimo.
Fixes#61645.
Built from https://develop.svn.wordpress.org/trunk@58717
git-svn-id: http://core.svn.wordpress.org/trunk@58119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This addresses a discrepancy where using `unlink()` allows for checking if it was successful via the return value, but `wp_delete_file()` did not have a return value, making it impossible to verify the result without doing overhead checks if the file still exists.
This also brings more consistency with the other `wp_delete_*()` functions, specifically:
* `wp_delete_file_from_directory()`
* `wp_delete_post()`
* `wp_delete_post_revision()`
* `wp_delete_attachment()`
* `wp_delete_attachment_files()`
* `wp_delete_comment()`
* `wp_delete_nav_menu()`
* `wp_delete_term()`
* `wp_delete_site()`
* `wp_delete_user()`
Includes adding basic unit tests for `wp_delete_file()`.
Follow-up to [31575].
Props bedas, debarghyabanerjee, mukesh27, SergeyBiryukov.
Fixes#61590.
Built from https://develop.svn.wordpress.org/trunk@58715
git-svn-id: http://core.svn.wordpress.org/trunk@58117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The HTML Processor internally throws an exception when it reaches HTML
that it knows it cannot process, but this exception is not made
available to calling code. It can be useful to extract more knowledge
about why it gave up, especially for debugging purposes.
In this patch, more context is added to the WP_HTML_Unsupported_Exception
and the last exception is made available to calling code through a new
method, `get_unsupported_exception()`.
Developed in https://github.com/WordPress/wordpress-develop/pull/6985
Discussed in https://core.trac.wordpress.org/ticket/61646
Props bernhard-reiter, dmsnell, jonsurrell.
See #61646.
Built from https://develop.svn.wordpress.org/trunk@58714
git-svn-id: http://core.svn.wordpress.org/trunk@58116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since the HTML Processor started visiting all nodes in a document, both
real and virtual, the breadcrumb accounting became a bit complicated
and it's not entirely clear that it is fully reliable.
In this patch the breadcrumbs are rebuilt separately from the stack of
open elements in order to eliminate the problem of the stateful stack
interactions and the post-hoc event queue.
Breadcrumbs are greatly simplified as a result, and more verifiably
correct, in this construction.
Developed in https://github.com/WordPress/wordpress-develop/pull/6981
Discussed in https://core.trac.wordpress.org/ticket/61576
Follow-up to [58590].
Props bernhard-reiter, dmsnell.
See #61576.
Built from https://develop.svn.wordpress.org/trunk@58713
git-svn-id: http://core.svn.wordpress.org/trunk@58115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Many tests from the html5lib test suite fail because of differences in
text handling between a DOM API and the HTML API, even though the
semantics of the parse are equivalent. For example, it's possible in
the HTML API to read multiple successive text nodes when the tokens
between them are ignored.
The test suite didn't account for this and so was failing tests. This
patch improves the construction of the representation to compare
against the test suite so that those tests don't fail inaccurately.
Developed in https://github.com/WordPress/wordpress-develop/pull/6984
Discussed in https://core.trac.wordpress.org/ticket/61576
Props bernhard-reiter, dmsnell, jonsurrell.
See #61576.
Built from https://develop.svn.wordpress.org/trunk@58712
git-svn-id: http://core.svn.wordpress.org/trunk@58114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds a fail-safe to return an empty string should the `switch` ever fall through without returning.
Currently, `WP_REST_Templates_Controller::get_wp_templates_author_text_field()` is tightly coupled to `WP_REST_Templates_Controller::get_wp_templates_original_source_field()`. However, if the `$original_source` values change in either method, but not both, it is possible a `void` or `null` will be returned, rather than a `string`.
Follow-up to [57366].
Props antonvlasenko, hellofromTonya, debarghyabanerjee.
Fixes#61580.
Built from https://develop.svn.wordpress.org/trunk@58705
git-svn-id: http://core.svn.wordpress.org/trunk@58107 1a063a9b-81f0-0310-95a4-ce76da25c4cd