Title: PHP related improvements &amp; changes: WordPress 5.5 edition
Author: Jonathan Desrosiers
Published: July 14, 2020

---

 [  ](https://profiles.wordpress.org/desrosj/) [Jonathan Desrosiers](https://profiles.wordpress.org/desrosj/)
7:21 pm _on_ July 14, 2020     
Tags: [5.5 ( 87 )](https://make.wordpress.org/core/tag/5-5/),
[Build Tools ( 5 )](https://make.wordpress.org/core/tag/build-tools/), [dev-notes ( 654 )](https://make.wordpress.org/core/tag/dev-notes/),
[PHP ( 79 )](https://make.wordpress.org/core/tag/php/)   

# PHP related improvements & changes: WordPress 5.5 edition

As part of an ongoing effort to improve compatibility across all supported versions
of PHPPHP The web scripting language in which WordPress is primarily architected.
WordPress requires PHP 7.4 or higher (currently 5.6.20–7.4), several tooling additions
and improvements have been made during the 5.5 cycle.

A large handful of changes were made to address the findings from these tools. Below
are some that you need to be aware of.

## Automated PHP compatibility scanning

During the WordPress 5.3 cycle, a new job was added to [Core’s Travis-CI builds](https://travis-ci.com/WordPress/wordpress-develop/)
to scan for potential PHP compatibility issues using the [PHPCompatibilityWP PHPCS ruleset](https://github.com/PHPCompatibility/PHPCompatibilityWP)(
see [#46152](https://core.trac.wordpress.org/ticket/46152)). However, because the
scan was reporting a large number of potential issues, it was placed in the `allowed_failures`
list until each issue could be inspected and addressed.

During the 5.5 cycle, each potential issue was examined individually and either 
fixed, or manually marked as a false-positive.

**As of [[48046]](https://core.trac.wordpress.org/changeset/48046), the job performing
a PHP compatibility scan has been removed from the `allowed_failures` list.** 🎉

Now that this scan is not allowed to produce errors or warnings, potential PHP incompatibilities
can be flagged and inspected immediately after being committed, ensuring they are
never released to the world in WordPress.

In the future when the versions of PHP supported by WordPress change (in either 
direction), the [configuration file](https://core.trac.wordpress.org/browser/trunk/phpcompat.xml.dist#L8)
can easily be adjusted to detect potential problems within the new range of supported
versions.

For more information, see the related ticketticket Created for both bug reports 
and feature development on the bug tracker. on TracTrac An open source project by
Edgewall Software that serves as a bug tracker and project management tool for WordPress.(
[#49922](https://core.trac.wordpress.org/ticket/49922)).

## Deprecated: wp_unregister_GLOBALS()

The `register_globals` directive in PHP was deprecated in version 5.3 and removed
entirely in 5.4. Because the first line of the function calls `ini_get()` (which
returns `false` if the directive is not recognized), this function will always return
early making it unnecessary.

**The `wp_unregister_GLOBALS()` function is deprecated as of WordPress 5.5.**

For more information, see the related ticket on Trac ([#49938](https://core.trac.wordpress.org/ticket/49938)).

## Deprecated: `$HTTP_RAW_POST_DATA`

The `$HTTP_RAW_POST_DATA` global variable was [deprecated in PHP 5.6.0 and removed completely in PHP 7.0.0](https://www.php.net/manual/en/reserved.variables.httprawpostdata.php).
Because of this, developers should not be relying the presence or accuracy of this
variable. However, a [search of the plugin directory](https://wpdirectory.net/search/01E6YDJDD16Q1TQR25YX4PNEJY)
for this variable still yields ~1,500 results. Although some of these matches are
flagging `$HTTP_RAW_POST_DATA` within comments or in compatibility shims, developers
should audit their code to remove this variable whenever possible.

**Because PHP 5.6 is still supported and this variable is present in a large number
of plugins, it will not be completely removed in WordPress 5.5. However, it will
be removed from CoreCore Core is the set of software required to run WordPress. 
The Core Development Team builds WordPress. when the supported versions of PHP is
changed to PHP >= 7.0.**

The following is the recommended replacement:

    ```notranslate
    $var = file_get_contents( 'php://input' );
    ```

A few occurrences of this variable that did not affect the outcome of the code have
been removed in 5.5. However, there are 2 instances that will remain because they
were deemed particularly risky to remove before communicating the bad practice to
the community.

 * `xmplrpc.php` ([source](https://core.trac.wordpress.org/browser/trunk/src/xmlrpc.php#L18))
 * `wp-includes/rest-api/class-wp-rest-server.php` ([source](https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rest-api/class-wp-rest-server.php#L1385))

For more information, refer to the related ticket on Trac ([#49810](https://core.trac.wordpress.org/ticket/49810)).

## Spread operator usage in the IXR library

In WordPress 5.3, the PHP [spread](https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.variadics)
[operator](https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.splat)
was introduced throughout the code base. There are several benefits to utilizing
the spread operator in addition to code modernization:

> “Using the spread operator allowed for simplifying the code and improves performance–
> both in speed as well as memory use -, especially as it has been introduced in
> a number of functions which are used a multitude of times during _every_ _single_
> pageload…”
> [WP 5.3: Introducing the spread operator](https://make.wordpress.org/core/2019/10/09/wp-5-3-introducing-the-spread-operator/)
> by @jrf

The IXR library bundled with Core (now treated as an “adopted” library) powers XML-
RPC related functionality in WordPress.

**All `func_get_args()` calls within the IXR library’s code have now been updated
to utilize the spread operator.**

For more information, refer to the Trac ticket ([#48267](https://core.trac.wordpress.org/ticket/48267)),
the [WP 5.3: Introducing the spread operator](https://make.wordpress.org/core/2019/10/09/wp-5-3-introducing-the-spread-operator/)
dev notedev note Each important change in WordPress Core is documented in a developers
note, (usually called dev note). Good dev notes generally include a description 
of the change, the decision that led to this change, and a description of how developers
are supposed to work with that change. Dev notes are published on Make/Core blog
during the beta phase of WordPress release cycle. Publishing dev notes is particularly
important when plugin/theme authors and WordPress developers need to be aware of
those changes.In general, all dev notes are compiled into a Field Guide at the beginning
of the release candidate phase., or the Trac ticket that originally introduced the
spread operator to Core ([#47678](https://core.trac.wordpress.org/ticket/47678)).

## Installing PHPUnit with Composer

Getting a local environment up and running for contributing to WordPress Core can
sometimes be difficult, especially when running the PHPUnit test suite is desired.
[Different combinations of WordPress and PHP versions require different versions of PHPUnit](https://make.wordpress.org/core/handbook/references/phpunit-compatibility-and-wordpress-versions/).

Composer is a tool for dependency management in PHP. When project dependencies are
specified, it will manage installing and updating those dependencies for you appropriately.

**As of [[47881]](https://core.trac.wordpress.org/changeset/47881), PHPUnit is now
defined as a dev requirement in WordPress Core’s `composer.json` file.**

Running `composer install` will determine the appropriate version of PHPUnit to 
install based on the PHP version Composer runs on.

For more information, refer to the Trac ticket ([#46815](https://core.trac.wordpress.org/ticket/46815)).

## Other Build/Test Tool improvements

 * Plugins and themes within `src` are now ignored when running Core linting locally.
   This will prevent coding standards violations from being flagged when developing
   locally using `src` instead of `build` (see [#49781](https://core.trac.wordpress.org/ticket/49781)).
 * Previously, when the `lint:php` job ran on Travis-CI, the code was formatted 
   using PHPCBF prior to linting. Since running `composer format` returns an error
   when changes are made, the linting part would not execute and a report would 
   not be generated. Core will no longer run the formatting command prior to linting
   the code base for issues (see [#49722](https://core.trac.wordpress.org/ticket/49722)).
 * The WordPress Coding StandardsWordPress Coding Standards The Accessibility, PHP,
   JavaScript, CSS, HTML, etc. coding standards as published in the WordPress [Coding Standards Handbook](https://developer.wordpress.org/coding-standards/).
   May also refer to [The collection of PHP_CodeSniffer rules](https://github.com/WordPress/WordPress-Coding-Standards/)(
   sniffs) used to format and validate PHP code developed for WordPress according
   to the PHP coding standards. ruleset has been updated from version 2.1.1 to 2.3.0.
   For a [full list of changes](https://github.com/WordPress/WordPress-Coding-Standards/compare/2.1.1...2.3.0)
   included in this update, [read ruleset’s release notes](https://github.com/WordPress/WordPress-Coding-Standards/releases)(
   see [#50258](https://core.trac.wordpress.org/ticket/50258)).
 * The recommended version of PHP specified in the `readme.html` file has been changed
   from 7.3 to 7.4. This brings the recommendation in line with the [recommendations found on WordPress.org](https://wordpress.org/about/requirements/)(
   see [#50480](https://core.trac.wordpress.org/ticket/50480))

_Props [@earnjam](https://profiles.wordpress.org/earnjam/) for review._

[#5-5](https://make.wordpress.org/core/tag/5-5/), [#build-tools](https://make.wordpress.org/core/tag/build-tools/),
[#dev-notes](https://make.wordpress.org/core/tag/dev-notes/), [#php](https://make.wordpress.org/core/tag/php/)

### Share this:

 * [  Threads ](https://make.wordpress.org/core/2020/07/14/php-related-improvements-changes-wordpress-5-5-edition/?share=threads)
 * [  Mastodon ](https://make.wordpress.org/core/2020/07/14/php-related-improvements-changes-wordpress-5-5-edition/?share=mastodon)
 * [  Bluesky ](https://make.wordpress.org/core/2020/07/14/php-related-improvements-changes-wordpress-5-5-edition/?share=bluesky)
 * [  X ](https://make.wordpress.org/core/2020/07/14/php-related-improvements-changes-wordpress-5-5-edition/?share=x)
 * [  Facebook ](https://make.wordpress.org/core/2020/07/14/php-related-improvements-changes-wordpress-5-5-edition/?share=facebook)
 * [  LinkedIn ](https://make.wordpress.org/core/2020/07/14/php-related-improvements-changes-wordpress-5-5-edition/?share=linkedin)

 1. ![](https://secure.gravatar.com/avatar/247c6d64a9cef124d55f50af6588ea5c0b96c59dae02a045a59eab31bc7cd7e5?
    s=32&d=mm&r=g)
 2.  [BackuPs](https://profiles.wordpress.org/backups/)  6:55 am _on_ July 15, 2020
 3. What happened to jquery-migrate.js in wp 5.5? It seems to have disappeared in the
    default loading. How to still get it loaded?
 4.  * ![](https://secure.gravatar.com/avatar/18f4f7ebdcd48383951a52a88f401bd6460ae74b626016010b1f0604cac90826?
       s=32&d=mm&r=g)
     *  [Jonathan Desrosiers](https://profiles.wordpress.org/desrosj/)  2:53 pm _on_
       July 15, 2020
     * This is a question better suited for the [Updating jQuery version shipped with WordPress post](https://make.wordpress.org/core/2020/06/29/updating-jquery-version-shipped-with-wordpress/),
       which outlines the changes related to jQuery and jQuery Migrate.
     * For reference, [@backups](https://profiles.wordpress.org/backups/) created a
       ticketticket Created for both bug reports and feature development on the bug
       tracker. on TracTrac An open source project by Edgewall Software that serves
       as a bug tracker and project management tool for WordPress. that has more follow
       up discussion: [https://core.trac.wordpress.org/ticket/50668](https://core.trac.wordpress.org/ticket/50668).
 5. ![](https://secure.gravatar.com/avatar/18f4f7ebdcd48383951a52a88f401bd6460ae74b626016010b1f0604cac90826?
    s=32&d=mm&r=g)
 6.  [Jonathan Desrosiers](https://profiles.wordpress.org/desrosj/)  6:36 pm _on_ July
    15, 2020
 7. +make.wordpress.org/plugins/

Comments are closed.

# Post navigation

[← Editor Chat Agenda: 15 July, 2020](https://make.wordpress.org/core/2020/07/14/editor-chat-agenda-15-july-2020/)

[Lazy-loading images in 5.5 →](https://make.wordpress.org/core/2020/07/14/lazy-loading-images-in-5-5/)