Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ LOCAL_PHP_XDEBUG_MODE=develop,debug
# Whether or not to enable Memcached.
LOCAL_PHP_MEMCACHED=false

# Whether or not to enable PCOV.
LOCAL_PHP_PCOV=false

##
# The database software to use.
#
Expand All @@ -46,12 +49,12 @@ LOCAL_DB_TYPE=mysql
##
# The database version to use.
#
# Defaults to 8.0 with the assumption that LOCAL_DB_TYPE is set to `mysql` above.
# Defaults to 9.7 with the assumption that LOCAL_DB_TYPE is set to `mysql` above.
#
# When using `mysql`, see https://hub.docker.com/_/mysql for valid versions.
# When using `mariadb`, see https://hub.docker.com/_/mariadb for valid versions.
##
LOCAL_DB_VERSION=8.4
LOCAL_DB_VERSION=9.7

# Whether or not to enable multisite.
LOCAL_MULTISITE=false
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/install-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ jobs:
- db-version: '9.3'
- db-version: '9.4'
- db-version: '9.5'
- db-version: '9.6'
# MySQL 9.0+ will not work on PHP 7.2 & 7.3. See https://core.trac.wordpress.org/ticket/61218.
- php: '7.2'
db-version: '9.6'
db-version: '9.7'
- php: '7.3'
db-version: '9.6'
db-version: '9.7'

services:
database:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/local-docker-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ jobs:
- db-version: '9.3'
- db-version: '9.4'
- db-version: '9.5'
- db-version: '9.6'
# No PHP 8.5 + Memcached support yet.
- php: '8.5'
memcached: true
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
os: [ ubuntu-24.04 ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0', '8.4' ]
db-version: [ '5.7', '8.0', '8.4', '9.7' ]
tests-domain: [ 'example.org' ]
multisite: [ false, true ]
memcached: [ false ]
Expand Down Expand Up @@ -209,15 +209,13 @@ jobs:
os: [ ubuntu-24.04 ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
db-type: [ 'mysql', 'mariadb' ]
db-version: [ '9.6', '12.1' ]
db-version: [ '12.1' ]
multisite: [ false, true ]
memcached: [ false ]
db-innovation: [ true ]

exclude:
# Exclude version combinations that don't exist.
- db-type: 'mariadb'
db-version: '9.6'
- db-type: 'mysql'
db-version: '12.1'
with:
Expand Down Expand Up @@ -283,14 +281,14 @@ jobs:
fail-fast: false
matrix:
php: [ '7.4', '8.4' ]
db-version: [ '8.4', '11.8' ]
db-version: [ '9.7', '11.8' ]
db-type: [ 'mysql', 'mariadb' ]
multisite: [ false ]

include:
# Include one multisite job for each database type.
- php: '8.4'
db-version: '8.4'
db-version: '9.7'
db-type: 'mysql'
multisite: true
- php: '8.4'
Expand All @@ -299,13 +297,13 @@ jobs:
multisite: true
# Test with memcached.
- php: '8.4'
db-version: '8.4'
db-version: '9.7'
db-type: 'mysql'
multisite: true
memcached: true
# Run specific test groups once.
- php: '8.4'
db-version: '8.4'
db-version: '9.7'
db-type: 'mysql'
phpunit-test-groups: 'html-api-html5lib-tests'

Expand All @@ -314,7 +312,7 @@ jobs:
- db-type: 'mysql'
db-version: '11.8'
- db-type: 'mariadb'
db-version: '8.4'
db-version: '9.7'

with:
php: ${{ matrix.php }}
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/reusable-performance-test-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
# - Configure environment variables.
# - Checkout repository.
# - Set up Node.js.
# - Set up PHP.
# - Log debug information.
# - Install npm dependencies.
# - Install Playwright browsers.
Expand Down Expand Up @@ -127,6 +128,14 @@ jobs:
node-version-file: '.nvmrc'
cache: npm

- name: Set up PHP
if: ${{ inputs.subject == 'base' }}
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
with:
php-version: ${{ inputs.php-version }}
tools: wp-cli
coverage: none

- name: Log debug information
run: |
npm --version
Expand Down Expand Up @@ -183,7 +192,7 @@ jobs:
if: ${{ inputs.subject == 'base' }}
run: |
VERSION="${BASE_TAG%.0}"
npm run env:cli -- core download --version="$VERSION" --force --path="/var/www/${LOCAL_DIR}"
wp core download --version="$VERSION" --force --path="${LOCAL_DIR}"

- name: Install object cache drop-in
if: ${{ inputs.memcached }}
Expand Down
18 changes: 5 additions & 13 deletions .github/workflows/reusable-phpunit-tests-v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ on:

env:
LOCAL_PHP: ${{ inputs.php }}-fpm
LOCAL_PHP_XDEBUG: ${{ inputs.coverage-report || false }}
LOCAL_PHP_XDEBUG_MODE: ${{ inputs.coverage-report && 'coverage' || 'develop,debug' }}
LOCAL_PHP_XDEBUG: false
LOCAL_PHP_XDEBUG_MODE: 'develop,debug'
LOCAL_PHP_PCOV: ${{ inputs.coverage-report }}
LOCAL_DB_TYPE: ${{ inputs.db-type }}
LOCAL_DB_VERSION: ${{ inputs.db-version }}
LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }}
Expand Down Expand Up @@ -113,7 +114,6 @@ jobs:
# - Install WordPress within the Docker container.
# - Run the PHPUnit tests.
# - Upload the code coverage report to Codecov.io.
# - Upload the HTML code coverage report as an artifact.
# - Ensures version-controlled files are not modified or deleted.
# - Checks out the WordPress Test reporter repository.
# - Submit the test results to the WordPress.org host test results.
Expand Down Expand Up @@ -204,12 +204,12 @@ jobs:
- name: Run PHPUnit tests${{ inputs.phpunit-test-groups && format( ' ({0} groups)', inputs.phpunit-test-groups ) || '' }}${{ inputs.coverage-report && ' with coverage report' || '' }}
continue-on-error: ${{ inputs.allow-errors }}
run: |
node ./tools/local-env/scripts/docker.js run \
node ./tools/local-env/scripts/docker.js ${{ inputs.coverage-report && 'exec' || 'run' }} \
php ./vendor/bin/phpunit \
--verbose \
-c "${PHPUNIT_CONFIG}" \
${{ inputs.phpunit-test-groups && '--group "${TEST_GROUPS}"' || '' }} \
${{ inputs.coverage-report && '--coverage-clover "wp-code-coverage-${MULTISITE_FLAG}-${GITHUB_SHA}.xml" --coverage-html "wp-code-coverage-${MULTISITE_FLAG}-${GITHUB_SHA}"' || '' }}
${{ inputs.coverage-report && '--coverage-clover "wp-code-coverage-${MULTISITE_FLAG}-${GITHUB_SHA}.xml"' || '' }}
env:
TEST_GROUPS: ${{ inputs.phpunit-test-groups }}
MULTISITE_FLAG: ${{ inputs.multisite && 'multisite' || 'single' }}
Expand Down Expand Up @@ -244,14 +244,6 @@ jobs:
flags: ${{ inputs.multisite && 'multisite' || 'single' }},php
fail_ci_if_error: true

- name: Upload HTML coverage report as artifact
if: ${{ inputs.coverage-report }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }}
path: wp-code-coverage${{ inputs.multisite && '-multisite' || '-single' }}-${{ github.sha }}
overwrite: true

- name: Ensure version-controlled files are not modified or deleted
run: git diff --exit-code

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ concurrency:
permissions: {}

env:
LOCAL_PHP_XDEBUG: true
LOCAL_PHP_XDEBUG_MODE: 'coverage'
LOCAL_PHP_MEMCACHED: false
PUPPETEER_SKIP_DOWNLOAD: true

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/upgrade-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
os: [ 'ubuntu-24.04' ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0', '8.4', '9.6' ]
db-version: [ '5.7', '8.0', '8.4', '9.7' ]
wp: [ '6.9', '7.0' ]
multisite: [ false, true ]
with:
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
os: [ 'ubuntu-24.04' ]
php: [ '7.4' ]
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.0', '8.4', '9.6' ]
db-version: [ '5.7', '8.0', '8.4', '9.7' ]
wp: [ '4.7' ]
multisite: [ false, true ]
with:
Expand Down
8 changes: 1 addition & 7 deletions .version-support-mysql.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
{
"7-1": [
"9.6",
"9.5",
"9.4",
"9.3",
"9.2",
"9.1",
"9.0",
"9.7",
"8.4",
"8.0",
"5.7",
Expand Down
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ services:
# The PHP container.
##
php:
image: wordpressdevelop/php:${LOCAL_PHP-latest}
image: ghcr.io/wordpress/wpdev-docker-images/php:${LOCAL_PHP-latest}-210

networks:
- wpdevnet

environment:
LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
XDEBUG_MODE: ${LOCAL_PHP_XDEBUG_MODE-develop,debug}
LOCAL_PHP_PCOV: ${LOCAL_PHP_PCOV-false}
LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
PHP_FPM_UID: ${PHP_FPM_UID-1000}
PHP_FPM_GID: ${PHP_FPM_GID-1000}
Expand Down Expand Up @@ -92,13 +93,14 @@ services:
# The WP CLI container.
##
cli:
image: wordpressdevelop/cli:${LOCAL_PHP-latest}
image: ghcr.io/wordpress/wpdev-docker-images/cli:${LOCAL_PHP-latest}-210

networks:
- wpdevnet

environment:
LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
LOCAL_PHP_PCOV: ${LOCAL_PHP_PCOV-false}
LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
PHP_FPM_UID: ${PHP_FPM_UID-1000}
PHP_FPM_GID: ${PHP_FPM_GID-1000}
Expand Down
3 changes: 3 additions & 0 deletions src/wp-includes/class-wp-hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public function add_filter( $hook_name, $callback, $priority, $accepted_args ) {
}

$idx = _wp_filter_build_unique_id( $hook_name, $callback, $priority );
if ( null === $idx ) {
return;
}

$priority_existed = isset( $this->callbacks[ $priority ] );

Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/class-wp-widget-factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function WP_Widget_Factory() {
*/
public function register( $widget ) {
if ( $widget instanceof WP_Widget ) {
$this->widgets[ spl_object_hash( $widget ) ] = $widget;
$this->widgets[ spl_object_id( $widget ) ] = $widget;
} else {
$this->widgets[ $widget ] = new $widget();
}
Expand All @@ -74,7 +74,7 @@ public function register( $widget ) {
*/
public function unregister( $widget ) {
if ( $widget instanceof WP_Widget ) {
unset( $this->widgets[ spl_object_hash( $widget ) ] );
unset( $this->widgets[ spl_object_id( $widget ) ] );
} else {
unset( $this->widgets[ $widget ] );
}
Expand Down
31 changes: 17 additions & 14 deletions src/wp-includes/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -986,33 +986,36 @@ function _wp_call_all_hook( $args ) {
* @since 2.2.3
* @since 5.3.0 Removed workarounds for spl_object_hash().
* `$hook_name` and `$priority` are no longer used,
* and the function always returns a string.
* and no longer returns false, but can still return void for invalid callbacks.
* @since 6.9.0 Returns explicit null if an invalid callback is supplied.
* @since 7.1.0 Uses spl_object_id() instead of spl_object_hash() for performance.
*
* @access private
*
* @param string $hook_name Unused. The name of the filter to build ID for.
* @param callable|string|array $callback The callback to generate ID for. The callback may
* or may not exist.
* @param int $priority Unused. The order in which the functions
* associated with a particular action are executed.
* @return string|null Unique function ID for usage as array key.
* Null if a valid `$callback` is not passed.
* @param string $hook_name Unused. The name of the filter to build ID for.
* @param callable $callback The callback to generate ID for. The callback may
* or may not exist.
* @param int $priority Unused. The order in which the functions
* associated with a particular action are executed.
* @return string|null Unique function ID for usage as array key, or null if it couldn't be determined.
*/
function _wp_filter_build_unique_id( $hook_name, $callback, $priority ) {
function _wp_filter_build_unique_id( $hook_name, $callback, $priority ): ?string {
if ( is_string( $callback ) ) {
return $callback;
}

if ( is_object( $callback ) ) {
// Closures are currently implemented as objects.
$callback = array( $callback, '' );
} else {
$callback = (array) $callback;
return (string) spl_object_id( (object) $callback );
}

$callback = (array) $callback;
if ( ! isset( $callback[1] ) || ! is_string( $callback[1] ) ) {
return null;
}

if ( is_object( $callback[0] ) ) {
// Object class calling.
return spl_object_hash( $callback[0] ) . $callback[1];
return ( (string) spl_object_id( $callback[0] ) ) . $callback[1];
} elseif ( is_string( $callback[0] ) ) {
// Static calling.
return $callback[0] . '::' . $callback[1];
Expand Down
Loading