diff --git a/package.json b/package.json index a5a2a117a6..d691ed2e6e 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "recompile:php:web:asyncify:7.2": "nx recompile-php:asyncify php-wasm-web -- --PHP_VERSION=7.2 ", "recompile:php:node": "nx recompile-php:all php-wasm-node ", "recompile:php:node:jspi:all": "nx recompile-php:jspi:all php-wasm-node ", + "recompile:php:node:jspi:8.5": "nx recompile-php:jspi php-wasm-node -- --PHP_VERSION=8.5 ", "recompile:php:node:jspi:8.4": "nx recompile-php:jspi php-wasm-node -- --PHP_VERSION=8.4 ", "recompile:php:node:jspi:8.3": "nx recompile-php:jspi php-wasm-node -- --PHP_VERSION=8.3 ", "recompile:php:node:jspi:8.2": "nx recompile-php:jspi php-wasm-node -- --PHP_VERSION=8.2 ", @@ -54,6 +55,7 @@ "recompile:php:node:jspi:7.3": "nx recompile-php:jspi php-wasm-node -- --PHP_VERSION=7.3 ", "recompile:php:node:jspi:7.2": "nx recompile-php:jspi php-wasm-node -- --PHP_VERSION=7.2 ", "recompile:php:node:asyncify:all": "nx recompile-php:asyncify:all php-wasm-node ", + "recompile:php:node:asyncify:8.5": "nx recompile-php:asyncify php-wasm-node -- --PHP_VERSION=8.5 ", "recompile:php:node:asyncify:8.4": "nx recompile-php:asyncify php-wasm-node -- --PHP_VERSION=8.4 ", "recompile:php:node:asyncify:8.3": "nx recompile-php:asyncify php-wasm-node -- --PHP_VERSION=8.3 ", "recompile:php:node:asyncify:8.2": "nx recompile-php:asyncify php-wasm-node -- --PHP_VERSION=8.2 ", diff --git a/packages/docs/site/docs/blueprints/03-data-format.md b/packages/docs/site/docs/blueprints/03-data-format.md index b8cf366be2..1e40c69473 100644 --- a/packages/docs/site/docs/blueprints/03-data-format.md +++ b/packages/docs/site/docs/blueprints/03-data-format.md @@ -54,7 +54,7 @@ The `landingPage` property tells Playground which URL to navigate to after the B The `preferredVersions` property declares your preferred PHP and WordPress versions. It can contain the following properties: -- `php` (string): Loads the specified PHP version. Accepts `7.0`, `7.1`, `7.2`, `7.3`, `7.4`, `8.0`, `8.1`, `8.2`, `8.3`, `8.4`, or `latest`. Minor versions like `7.4.1` are not supported. +- `php` (string): Loads the specified PHP version. Accepts `7.0`, `7.1`, `7.2`, `7.3`, `7.4`, `8.0`, `8.1`, `8.2`, `8.3`, `8.4`, `8.5`, or `latest`. Minor versions like `7.4.1` are not supported. - `wp` (string): Loads the specified WordPress version. Accepts the last four major WordPress versions. As of June 1, 2024, that's `6.2`, `6.3`, `6.4`, or `6.5`. You can also use the generic values `latest`, `nightly`, or `beta`. To use a pre-release version of WordPress, `beta` will load the latest beta or release candidate versions of a release cycle (Beta or RC). ```js diff --git a/packages/docs/site/i18n/ja/docusaurus-plugin-content-docs/current/blueprints/03-data-format.md b/packages/docs/site/i18n/ja/docusaurus-plugin-content-docs/current/blueprints/03-data-format.md index 04d030a947..9a5dc7b9c6 100644 --- a/packages/docs/site/i18n/ja/docusaurus-plugin-content-docs/current/blueprints/03-data-format.md +++ b/packages/docs/site/i18n/ja/docusaurus-plugin-content-docs/current/blueprints/03-data-format.md @@ -90,11 +90,11 @@ The `landingPage` property tells Playground which URL to navigate to after the B The `preferredVersions` property declares your preferred PHP and WordPress versions. It can contain the following properties: --> -- `php` (文字列): 指定された PHP バージョンを読み込みます。`7.0`、`7.1`、`7.2`、`7.3`、`7.4`、`8.0`、`8.1`、`8.2`、`8.3`、`8.4`、`latest` が使用できます。`7.4.1` などのマイナーバージョンはサポートされていません。 +- `php` (文字列): 指定された PHP バージョンを読み込みます。`7.0`、`7.1`、`7.2`、`7.3`、`7.4`、`8.0`、`8.1`、`8.2`、`8.3`、`8.4`、`8.5`、`latest` が使用できます。`7.4.1` などのマイナーバージョンはサポートされていません。 - `wp` (文字列): 指定された WordPress バージョンを読み込みます。最新の 4 つのメジャー WordPress バージョンが使用できます。2024 年 6 月 1 日時点では、`6.2`、`6.3`、`6.4`、`6.5` が使用できます。汎用値として `latest`、`nightly`、`beta` も使用できます。WordPress のプレリリース版を使用する場合、`beta` はリリースサイクルの最新のベータ版またはリリース候補版 (ベータ版または RC 版) を読み込みます。 diff --git a/packages/php-wasm/compile/php/Dockerfile b/packages/php-wasm/compile/php/Dockerfile index 70f941739a..7e5e0b7f1f 100644 --- a/packages/php-wasm/compile/php/Dockerfile +++ b/packages/php-wasm/compile/php/Dockerfile @@ -16,7 +16,7 @@ ARG WITH_OPCACHE # Clone PHP RUN git clone https://github.com/php/php-src.git php-src \ - --branch PHP-$PHP_VERSION \ + --tag php-$PHP_VERSION \ --single-branch \ --depth 1; diff --git a/packages/php-wasm/compile/php/php8.5.patch b/packages/php-wasm/compile/php/php8.5.patch new file mode 100644 index 0000000000..b1a30bd6a6 --- /dev/null +++ b/packages/php-wasm/compile/php/php8.5.patch @@ -0,0 +1,39 @@ +diff --git a/php-src/ext/opcache/zend_accelerator_debug.c b/php-src/ext/opcache/zend_accelerator_debug.c +index b2a3105dc62..f7e328312a8 100644 +--- a/php-src/ext/opcache/zend_accelerator_debug.c ++++ b/php-src/ext/opcache/zend_accelerator_debug.c +@@ -25,6 +25,9 @@ + #include + #ifdef ZEND_WIN32 + # include ++#else ++/* Error: call to undeclared function 'getpid' */ ++# include + #endif + #include "ZendAccelerator.h" + +diff --git a/php-src/ext/standard/file.c b/php-src/ext/standard/file.c +index 01f49640e4a..e559b61b0c6 100644 +--- a/php-src/ext/standard/file.c ++++ b/php-src/ext/standard/file.c +@@ -1507,6 +1507,20 @@ PHPAPI zend_result php_copy_file_ctx(const char *src, const char *dest, int src_ + goto safe_to_copy; + break; + case 0: ++ // Fix for https://github.com/WordPress/wordpress-playground/issues/54: ++ // Problem: Calling copy() on an empty source file crashes the JavaScript ++ // runtime. ++ // Solution: Avoid copying empty files. Just create create an empty ++ // destination file and return. ++ if (src_s.sb.st_size == 0) { ++ zend_string *opened_path = zend_string_init("", strlen(""), 0); ++ php_stream *stream = php_stream_open_wrapper(dest, "w", REPORT_ERRORS, &opened_path); ++ if (stream) { ++ php_stream_close(stream); ++ return SUCCESS; ++ } ++ return FAILURE; ++ } + break; + default: /* failed to stat file, does not exist? */ + return ret; diff --git a/packages/php-wasm/compile/project.json b/packages/php-wasm/compile/project.json index 522fceefb6..34b96a598d 100644 --- a/packages/php-wasm/compile/project.json +++ b/packages/php-wasm/compile/project.json @@ -22,6 +22,7 @@ "executor": "nx:run-commands", "options": { "commands": [ + "nx run php-wasm-compile:xdebug:asyncify --PHP_VERSION=8.5", "nx run php-wasm-compile:xdebug:asyncify --PHP_VERSION=8.4", "nx run php-wasm-compile:xdebug:asyncify --PHP_VERSION=8.3", "nx run php-wasm-compile:xdebug:asyncify --PHP_VERSION=8.2", @@ -47,6 +48,7 @@ "executor": "nx:run-commands", "options": { "commands": [ + "nx run php-wasm-compile:xdebug:jspi --PHP_VERSION=8.5", "nx run php-wasm-compile:xdebug:jspi --PHP_VERSION=8.4", "nx run php-wasm-compile:xdebug:jspi --PHP_VERSION=8.3", "nx run php-wasm-compile:xdebug:jspi --PHP_VERSION=8.2", diff --git a/packages/php-wasm/compile/update-php-versions.mjs b/packages/php-wasm/compile/update-php-versions.mjs index 327051214e..16fcbd65c1 100755 --- a/packages/php-wasm/compile/update-php-versions.mjs +++ b/packages/php-wasm/compile/update-php-versions.mjs @@ -90,7 +90,7 @@ async function fetchFromGitHub() { for (const tag of data) { const tagName = tag.name; // Match patterns like "php-8.3.15", "php-8.2.26", etc. - const match = tagName.match(/^php-(\d+)\.(\d+)\.(\d+)$/); + const match = tagName.match(/^php-(\d+)\.(\d+)\.(\d+)(?:alpha\d+)?$/); if (match) { const [, major, minor, patch] = match; const version = `${major}.${minor}`; diff --git a/packages/php-wasm/node/src/lib/get-php-loader-module.ts b/packages/php-wasm/node/src/lib/get-php-loader-module.ts index d64e11d822..1a0eedd2af 100644 --- a/packages/php-wasm/node/src/lib/get-php-loader-module.ts +++ b/packages/php-wasm/node/src/lib/get-php-loader-module.ts @@ -7,6 +7,9 @@ export async function getPHPLoaderModule( ): Promise { if (await jspi()) { switch (version) { + case '8.5': + // @ts-ignore + return await import(`../../jspi/php_8_5.js`); case '8.4': // @ts-ignore return await import(`../../jspi/php_8_4.js`); @@ -34,6 +37,9 @@ export async function getPHPLoaderModule( } } else { switch (version) { + case '8.5': + // @ts-ignore + return await import(`../../asyncify/php_8_5.js`); case '8.4': // @ts-ignore return await import(`../../asyncify/php_8_4.js`); diff --git a/packages/php-wasm/node/src/lib/xdebug/get-xdebug-extension-module.ts b/packages/php-wasm/node/src/lib/xdebug/get-xdebug-extension-module.ts index 7471ac42ad..1ae58a7eaf 100644 --- a/packages/php-wasm/node/src/lib/xdebug/get-xdebug-extension-module.ts +++ b/packages/php-wasm/node/src/lib/xdebug/get-xdebug-extension-module.ts @@ -18,6 +18,13 @@ export async function getXdebugExtensionModule( */ if (await jspi()) { switch (version) { + case '8.5': + return ( + await import( + // @ts-ignore + `../../../jspi/extensions/xdebug/8_5/xdebug.so?url` + ) + ).default; case '8.4': return ( await import( @@ -77,6 +84,13 @@ export async function getXdebugExtensionModule( } } else { switch (version) { + case '8.5': + return ( + await import( + // @ts-ignore + `../../../asyncify/extensions/xdebug/8_5/xdebug.so?url` + ) + ).default; case '8.4': return ( await import( diff --git a/packages/php-wasm/supported-php-versions.mjs b/packages/php-wasm/supported-php-versions.mjs index adf7d9b0cb..abebaf2484 100644 --- a/packages/php-wasm/supported-php-versions.mjs +++ b/packages/php-wasm/supported-php-versions.mjs @@ -6,13 +6,19 @@ * @property {string} lastRelease */ -export const lastRefreshed = '2025-08-04T12:45:56.385Z'; +export const lastRefreshed = '2025-08-07T12:09:02.133Z'; /** * @type {PhpVersion[]} * @see https://www.php.net/releases/index.php */ export const phpVersions = [ + { + version: '8.5', + loaderFilename: 'php_8_5.js', + wasmFilename: 'php_8_5.wasm', + lastRelease: '8.5.0alpha4', + }, { version: '8.4', loaderFilename: 'php_8_4.js', diff --git a/packages/php-wasm/universal/src/lib/supported-php-versions.ts b/packages/php-wasm/universal/src/lib/supported-php-versions.ts index b528ac48a8..cab32c29b3 100644 --- a/packages/php-wasm/universal/src/lib/supported-php-versions.ts +++ b/packages/php-wasm/universal/src/lib/supported-php-versions.ts @@ -1,4 +1,5 @@ export const SupportedPHPVersions = [ + '8.5', '8.4', '8.3', '8.2', diff --git a/packages/php-wasm/web/src/lib/get-php-loader-module.ts b/packages/php-wasm/web/src/lib/get-php-loader-module.ts index 3a95f46326..3dc6cec2e4 100644 --- a/packages/php-wasm/web/src/lib/get-php-loader-module.ts +++ b/packages/php-wasm/web/src/lib/get-php-loader-module.ts @@ -14,6 +14,9 @@ export async function getPHPLoaderModule( ): Promise { if (await jspi()) { switch (version) { + case '8.5': + // @ts-ignore + return await import('../../public/php/jspi/php_8_5.js'); case '8.4': // @ts-ignore return await import('../../public/php/jspi/php_8_4.js'); @@ -41,6 +44,9 @@ export async function getPHPLoaderModule( } } else { switch (version) { + case '8.5': + // @ts-ignore + return await import('../../public/php/asyncify/php_8_5.js'); case '8.4': // @ts-ignore return await import('../../public/php/asyncify/php_8_4.js'); diff --git a/packages/playground/blueprints/public/blueprint-schema-validator.js b/packages/playground/blueprints/public/blueprint-schema-validator.js index 72204a7076..5a9eb32fb7 100644 --- a/packages/playground/blueprints/public/blueprint-schema-validator.js +++ b/packages/playground/blueprints/public/blueprint-schema-validator.js @@ -156,7 +156,17 @@ const schema11 = { }, SupportedPHPVersion: { type: 'string', - enum: ['8.4', '8.3', '8.2', '8.1', '8.0', '7.4', '7.3', '7.2'], + enum: [ + '8.5', + '8.4', + '8.3', + '8.2', + '8.1', + '8.0', + '7.4', + '7.3', + '7.2', + ], }, ExtraLibrary: { type: 'string', const: 'wp-cli' }, PHPConstants: { diff --git a/packages/playground/blueprints/public/blueprint-schema.json b/packages/playground/blueprints/public/blueprint-schema.json index 40541d3ced..9371864184 100644 --- a/packages/playground/blueprints/public/blueprint-schema.json +++ b/packages/playground/blueprints/public/blueprint-schema.json @@ -173,7 +173,17 @@ }, "SupportedPHPVersion": { "type": "string", - "enum": ["8.4", "8.3", "8.2", "8.1", "8.0", "7.4", "7.3", "7.2"] + "enum": [ + "8.5", + "8.4", + "8.3", + "8.2", + "8.1", + "8.0", + "7.4", + "7.3", + "7.2" + ] }, "ExtraLibrary": { "type": "string",