The generated classmaps reference `/src/` files and operates in the assumption that the base directory is one level above `wp-settings.php`, which it isn't after our build processes are run.
See #36335
git-svn-id: https://develop.svn.wordpress.org/trunk@38402 602fd350-edb4-49c9-b593-d223f7449a82
WordPress always* passes $args to filters as an array of arugments. A exception is made in `wp_nav_menu()` and the associated walker where these are passed to filters as an object, this has been the case for seven years (since [13368]).
These new tests enforce the use of an object in these filters to ensure backward compatibility is maintained.
See #24587.
git-svn-id: https://develop.svn.wordpress.org/trunk@38400 602fd350-edb4-49c9-b593-d223f7449a82
* `wp-admin` and `wp-includes` are scanned for classes to autoload
* Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see `composer.json`: `autoload.exclude-from-classmap`
* `wp-vendor/autoload_52.php` is included at the top of `wp-settings.php` - no changes need to be made to unit tests to include the autoloader
* An avalanche of `require()` and `require_once()` calls that loaded class files have been removed from the codebase.
The following files have been added to `svn:ignore` - they are not 5.2-compatible and fail during pre-commit:
* src/wp-vendor/autoload.php
* src/wp-vendor/composer/autoload_real.php
* src/wp-vendor/composer/autoload_static.php
* src/wp-vendor/composer/ClassLoader.php
We favor these files instead:
* src/wp-vendor/autoload_52.php
* src/wp-vendor/composer/autoload_real_52.php
* src/wp-vendor/composer/ClassLoader52.php
When new PHP classes are added to the codebase, simply run `composer install` or `composer update` from the project root to update the autoloader.
The future is now.
See #36335.
git-svn-id: https://develop.svn.wordpress.org/trunk@38399 602fd350-edb4-49c9-b593-d223f7449a82
* Automatically delete objects that we were created during `wpSetUpBeforeClass` - posts, comments, terms (except 1), and user (except 1)
* The amount of leftover data between tests was breathtaking - use the new function: `_delete_all_data()`
* Commit database transactions for all `TestCase`s, not just those that implement `wpSetUpBeforeClass` and `wpTearDownAfterClass`
* The tests run 10-20 seconds faster now
See #37699.
git-svn-id: https://develop.svn.wordpress.org/trunk@38398 602fd350-edb4-49c9-b593-d223f7449a82
Blindly casting passed IDs to integers can generate false positives
when the ID is cast to `1`.
Props deeptiboddapati.
Fixes#37738.
git-svn-id: https://develop.svn.wordpress.org/trunk@38381 602fd350-edb4-49c9-b593-d223f7449a82
Let us remove the `$wp_site_icon` global. I will fall on the sword if this comes back to bite us (waiting with bated breath).
See #37699.
git-svn-id: https://develop.svn.wordpress.org/trunk@38355 602fd350-edb4-49c9-b593-d223f7449a82
By adding the `$output` parameter to `get_attachment_taxonomies()`, the
function signature matches that of `get_object_taxonomies()`. The change
also allows for more consistent behavior when passing `output=objects`
to `get_object_taxonomies()` for the 'attachment' object type, since
the `$output` parameter is now passed through the function stack.
Props codemovement.pk.
See #37368.
git-svn-id: https://develop.svn.wordpress.org/trunk@38292 602fd350-edb4-49c9-b593-d223f7449a82
Previously, the 'p' query var was being run through `absint()`, which
caused unexpected results.
Props Akeif, kouratoras.
Fixes#33372.
git-svn-id: https://develop.svn.wordpress.org/trunk@38288 602fd350-edb4-49c9-b593-d223f7449a82
[38058] changed `wp_mail()` so that it used PHPMailer's `setFrom()`
method rather than setting the From and FromName headers directly. See
behavior of setting the `Sender` field. This causes `mail` to be
called with the `-f` flag, which causes outgoing email to fail on some
server environments.
Props Clorith, iandunn, DrewAPicture.
Fixes#37736.
git-svn-id: https://develop.svn.wordpress.org/trunk@38286 602fd350-edb4-49c9-b593-d223f7449a82
This change prevents an error object from being stored in the cache,
and prevents notices from being thrown when plucking term IDs to put
into the relationship cache.
See #32044, #36814.
Props rpayne7264.
Fixes#37721.
git-svn-id: https://develop.svn.wordpress.org/trunk@38277 602fd350-edb4-49c9-b593-d223f7449a82
* Allow to add/remove a featured image to `attachment:audio` and `attachment:video` post types, see [27657].
* Change conditionals to check for theme OR post type support.
* Add tests for #12922.
Broken in [37658].
Props flixos90, joemcgill, DrewAPicture, wonderboymusic.
See #12922.
Fixes#37658.
git-svn-id: https://develop.svn.wordpress.org/trunk@38263 602fd350-edb4-49c9-b593-d223f7449a82
`wp_resource_hints()` parses the URL for the `preconnect` and `dns-prefetch` relation types to ensure correct values for both. While protocol-relative URLs are supported for `dns-prefetch`, the double slash was lost for `preconnect`.
Props swissspidy, peterwilsoncc.
Props azaozz for review.
Fixes#37652.
git-svn-id: https://develop.svn.wordpress.org/trunk@38255 602fd350-edb4-49c9-b593-d223f7449a82
First added in [37588] and later modified in [38224], the idea was to ensure that filters/actions added before `advance-cache.php` would not disappear if `advance-cache.php` overloaded the filters/actions with code such as `$wp_filter = array()`. This is an edge case and one that there is no documented case of existing.
This restores the behavior from WordPress 4.5 and before. It is strongly encouraged that developers using `advance-cache.php` to use the Plugins API that is available before the loading of `advance-cache.php` rather than directly interacting with any of the globals.
Props azaozz, jorbin, dd32 for review, pento for review, westi for investigation, ipstenu for research.
See #36819.
git-svn-id: https://develop.svn.wordpress.org/trunk@38251 602fd350-edb4-49c9-b593-d223f7449a82
[37588] added methods to backup the plugin globals, for ensuring that advanced cache drop-ins don't overwrite hooks that've been added earlier in the load process.
The method for restoring the plugin globals wasn't compatible with the implementation of `WP_Hook` in #17817. `WP_Hook` implements `ArrayAccess`, so `_restore_plugin_globals()` was treating it as an array, and inadvertantly overwriting the `WP_Hook` object with a plain array.
To avoid having to re-write this code as part of #17817, we now use `add_filter()` to restore any hooks that were added by cache drop-ins, which `WP_Hook` correctly supports.
Props pento, jorbin.
See #36819.
git-svn-id: https://develop.svn.wordpress.org/trunk@38223 602fd350-edb4-49c9-b593-d223f7449a82
The global `$current_blog` is not switched in `switch_to_blog()` and can
not be used to properly retrieve current switched site information.
See #37607.
git-svn-id: https://develop.svn.wordpress.org/trunk@38217 602fd350-edb4-49c9-b593-d223f7449a82
[37262] changed a check in `redirect_canonical()` so that it checked
categories in the object cache rather than querying the database. However,
the check was based on the identity of `WP_Term` objects, which in
certain cases can be augmented by the main WP query routine, causing
failures of the `in_array()` check. This caused unnecessary redirects
for URLs where `is_single()` is true, but the URL is different from the
post permalink, such as the `embed` endpoint.
`has_term()` also checks the cache, but does not sufer from this bug.
Props cmillerdev.
Fixes#36602.
git-svn-id: https://develop.svn.wordpress.org/trunk@38216 602fd350-edb4-49c9-b593-d223f7449a82
* Latin small letter n preceded by apostrophe
* Latin capital letter Eng
* Latin small letter Eng
Props gitlost.
Fixes#37564.
git-svn-id: https://develop.svn.wordpress.org/trunk@38193 602fd350-edb4-49c9-b593-d223f7449a82
Requests has its own cookie object in form of `Requests_Cookie`. Therefore we have to convert `WP_Http_Cookie` objects to `Requests_Cookie`.
This introduces `WP_Http_Cookie::get_attributes()` to retrieve cookie attributes of a `WP_Http_Cookie` object and `WP_Http::normalize_cookies()` to convert the cookie objects.
Fixes#37437.
git-svn-id: https://develop.svn.wordpress.org/trunk@38164 602fd350-edb4-49c9-b593-d223f7449a82
* `preconnect` will be potentially pretty heavy on the CDN. With the Unicode 9.0 emoji update, almost all browsers will trigger the `preconnect`.
* `preconnect` only opens one connection, but `s.w.org` is HTTP/1.1, so the browser will use the preconnected connection for the first emoji, then it has to open new connections for subsequent emoji.
Also use the same URL as we use for the `emoji_svg_url` filter. This will print the hint for the correct CDN in case someone uses a custom CDN.
Props peterwilsoncc.
Fixes#37387.
git-svn-id: https://develop.svn.wordpress.org/trunk@38122 602fd350-edb4-49c9-b593-d223f7449a82
When `IMAGE_EDIT_OVERWRITE` is set to true, edited image files are
supposed to be deleted when an image is restored to the original.
However, when an image was edited more than once, and then restored,
files created during previous edits were left behind.
Fixes this behavior by updating `wp_save_image()` to clean up
leftover images after each edit when `IMAGE_EDIT_OVERWRITE` is true.
Props bradt, chriscct7, joemcgill.
Fixes#32171.
git-svn-id: https://develop.svn.wordpress.org/trunk@38113 602fd350-edb4-49c9-b593-d223f7449a82
Externally hosted script and style dependencies trigger `dns-prefetch` hinting only when enqueued. This removed a bug in which hinting was added on registration.
Renames the function `wp_resource_hints_scripts_styles` to `wp_dependencies_unique_hosts` as the function provides the hosts, not the hinting.
Props swissspidy.
Fixes#37385.
git-svn-id: https://develop.svn.wordpress.org/trunk@38100 602fd350-edb4-49c9-b593-d223f7449a82
Prior to the introduction of `WP_Term_Query`, the 'orderby' clause
passed to the 'terms_clauses' filter was prefixed by `ORDER BY`. After
`WP_Term_Query`, this was not the case; `ORDER BY` was added after the
filter. As such, plugins filtering 'terms_clauses' and returning an
'orderby' clause beginning with `ORDER BY` resulted in invalid syntax
when `WP_Term_Query` prepended a second `ORDER BY` keyword to
the clause.
This changeset rearranges the way the 'orderby' clause is built so that
it will be passed to 'terms_clauses' in the previous format.
Fixes#37378.
git-svn-id: https://develop.svn.wordpress.org/trunk@38099 602fd350-edb4-49c9-b593-d223f7449a82
Registration is now based solely on object type, which allows the code around this to be simplified significantly.
In the process of making this adjustment:
* `register_meta()`, `unregister_meta_key()`, `get_registered_metadata()`, and `registered_meta_key_exists()` no longer return `WP_Error` objects.
* The recently introduced `wp_object_type_exists()` function and the restriction on object type has been removed.
Note: No guarantee of uniqueness is made across object subtypes. Registered meta keys should be uniquely prefixed to avoid conflict.
Fixes#35658.
git-svn-id: https://develop.svn.wordpress.org/trunk@38095 602fd350-edb4-49c9-b593-d223f7449a82