Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.4 support #2038

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"reset": "nx reset",
"recompile:php": "npm run recompile:php:web && npm run recompile:php:node",
"recompile:php:web:jspi:all": "nx recompile-php:jspi:all php-wasm-web",
"recompile:php:web:jspi:8.4": "nx recompile-php:jspi php-wasm-web -- --PHP_VERSION=8.4 ",
"recompile:php:web:jspi:8.3": "nx recompile-php:jspi php-wasm-web -- --PHP_VERSION=8.3 ",
"recompile:php:web:jspi:8.2": "nx recompile-php:jspi php-wasm-web -- --PHP_VERSION=8.2 ",
"recompile:php:web:jspi:8.1": "nx recompile-php:jspi php-wasm-web -- --PHP_VERSION=8.1 ",
Expand All @@ -34,6 +35,7 @@
"recompile:php:web:jspi:7.1": "nx recompile-php:jspi php-wasm-web -- --PHP_VERSION=7.1 ",
"recompile:php:web:jspi:7.0": "nx recompile-php:jspi php-wasm-web -- --PHP_VERSION=7.0 ",
"recompile:php:web:asyncify:all": "nx recompile-php:asyncify:all php-wasm-web",
"recompile:php:web:asyncify:8.4": "nx recompile-php:asyncify php-wasm-web -- --PHP_VERSION=8.4 ",
"recompile:php:web:asyncify:8.3": "nx recompile-php:asyncify php-wasm-web -- --PHP_VERSION=8.3 ",
"recompile:php:web:asyncify:8.2": "nx recompile-php:asyncify php-wasm-web -- --PHP_VERSION=8.2 ",
"recompile:php:web:asyncify:8.1": "nx recompile-php:asyncify php-wasm-web -- --PHP_VERSION=8.1 ",
Expand All @@ -45,6 +47,7 @@
"recompile:php:web:asyncify:7.0": "nx recompile-php:asyncify php-wasm-web -- --PHP_VERSION=7.0 ",
"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.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 ",
"recompile:php:node:jspi:8.1": "nx recompile-php:jspi php-wasm-node -- --PHP_VERSION=8.1 ",
Expand All @@ -55,6 +58,7 @@
"recompile:php:node:jspi:7.1": "nx recompile-php:jspi php-wasm-node -- --PHP_VERSION=7.1 ",
"recompile:php:node:jspi:7.0": "nx recompile-php:jspi php-wasm-node -- --PHP_VERSION=7.0 ",
"recompile:php:node:asyncify:all": "nx recompile-php:asyncify:all php-wasm-node ",
"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 ",
"recompile:php:node:asyncify:8.1": "nx recompile-php:asyncify php-wasm-node -- --PHP_VERSION=8.1 ",
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/site/docs/blueprints/03-data-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`, 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`, 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ You can go ahead and try it out. The Playground will automatically install the t

| Option | Default Value | Description |
| --------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `php` | `8.0` | Loads the specified PHP version. Accepts `7.0`, `7.1`, `7.2`, `7.3`, `7.4`, `8.0`, `8.1`, `8.2`, `8.3`, or `latest`. |
| `php` | `8.0` | 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`. |
| `wp` | `latest` | Loads the specified WordPress version. Accepts the last three major WordPress versions. As of June 1, 2024, that's `6.3`, `6.4`, or `6.5`. You can also use the generic values `latest`, `nightly`, or `beta`. |
| `blueprint-url` | | The URL of the Blueprint that will be used to configure this Playground instance. |
| `networking` | `no` | Enables or disables the networking support for Playground. Accepts `yes` or `no`. |
Expand Down
14 changes: 0 additions & 14 deletions packages/meta/bin/project_board_automation.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,6 @@
echo "– Removing \"Future Work\" card from the board: $humanIssueName\n";
continue;
}

if ($automation->moveBackToInboxAfterAuthorsReply($projectItem)) {
echo "– Author replied – moving the card back to inbox: $humanIssueName\n";
continue;
}

if (
// TODO: Replace this with explicit permissions check if that is possible.
$projectItem['content']['repository']['nameWithOwner'] !== 'WordPress/wporg-theme-directory' &&
$automation->addNeedsAuthorReplyLabelToANewItemWithThatStatus($projectItem)
) {
echo "– Adding \"Need Author's reply\" label to: $humanIssueName\n";
continue;
}
} catch (Exception $e) {
echo "Error processing card: $humanIssueName\n";
echo $e->getMessage() . "\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,70 +58,12 @@ public function archiveFutureWorkCard($projectItem)
$this->githubApi->removeItemFromProject($this->projectId, $projectItem['id']);
return true;
}

/**
* Find all cards with Status = "Needs author reply". If they do not
* have a "Needs author reply" label, add it.
*/
public function addNeedsAuthorReplyLabelToANewItemWithThatStatus($projectItem)
{
if(
!$this->hasStatus($projectItem, $this->needsAuthorReplyStatusText) ||
$this->hasLabel($projectItem, $this->needsAuthorReplyLabelText)
) {
return false;
}
$this->githubApi->addLabelByName(
$projectItem['content']['id'],
$this->needsAuthorReplyLabelText
);
return true;
}

public function iterateProjectItems()
{
yield from $this->githubApi->iterateProjectItems($this->projectId);
}

/**
* Find all cards with "Needs author reply" label. If any comments have
* been added since the last time that label was added, remove the label
* and clear the "Status" field.
*/
public function moveBackToInboxAfterAuthorsReply($projectItem)
{
// Process items that have **either** the status or the label.
// The author could have replied after the status was set, but before
// we had a chance to add a label.
if(
!$this->hasStatus($projectItem, $this->needsAuthorReplyStatusText) &&
!$this->hasLabel($projectItem, $this->needsAuthorReplyLabelText)
) {
return false;
}

$issueOrPrId = $projectItem['content']['id'];
$result = $this->checkIfAuthorRepliedAfterLabelWasCreated($issueOrPrId);

if (!$result['author_replied']) {
return false;
}

// Only remove the label if there was a label in the first place.
// The author may have replied after the status was set, but before
// we had a chance to add a label.
if (null !== $result['label_id']) {
$this->githubApi->removeLabelById($issueOrPrId, $result['label_id']);
}
$this->githubApi->setFieldValueById(
$this->projectId,
$projectItem['id'],
$this->statusFieldId,
$this->githubIds['fields']['status']['options']['inbox']
);
return true;
}

private function hasStatus($projectItem, $statusText)
{
$status = GitHubApi::extractProjectItemFieldValueById(
Expand Down
38 changes: 28 additions & 10 deletions packages/php-wasm/compile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,37 @@ libxml2/jspi/dist/root/lib/lib/libxml2.a: base-image libz_jspi
docker cp $$(docker create playground-php-wasm:libxml2):/root/lib/lib ./libxml2/jspi/dist/root/lib
docker cp $$(docker create playground-php-wasm:libxml2):/root/lib/include ./libxml2/jspi/dist/root/lib

libopenssl_asyncify: libopenssl/asyncify/dist/root/lib/lib/libssl.a
libopenssl/asyncify/dist/root/lib/lib/libssl.a: base-image libz_asyncify
libopenssl_asyncify: libopenssl/asyncify/dist/1.1.0h/root/lib/lib/libssl.a libopenssl/asyncify/dist/1.1.1/root/lib/lib/libssl.a

libopenssl/asyncify/dist/1.1.0h/root/lib/lib/libssl.a: base-image libz_asyncify
mkdir -p ./libopenssl/asyncify/dist/root/lib
docker build -f ./libopenssl/Dockerfile -t playground-php-wasm:libopenssl-1.1.0h . --build-arg OPENSSL_VERSION=1.1.0h
mkdir -p ./libopenssl/asyncify/dist/1.1.0h/root/lib
docker cp $$(docker create playground-php-wasm:libopenssl-1.1.0h):/root/install/lib ./libopenssl/asyncify/dist/1.1.0h/root/lib
docker cp $$(docker create playground-php-wasm:libopenssl-1.1.0h):/root/install/include ./libopenssl/asyncify/dist/1.1.0h/root/lib

libopenssl/asyncify/dist/1.1.1/root/lib/lib/libssl.a: base-image libz_asyncify
mkdir -p ./libopenssl/asyncify/dist/root/lib
docker build -f ./libopenssl/Dockerfile -t playground-php-wasm:libopenssl .
docker cp $$(docker create playground-php-wasm:libopenssl):/root/install/lib ./libopenssl/asyncify/dist/root/lib
docker cp $$(docker create playground-php-wasm:libopenssl):/root/install/include ./libopenssl/asyncify/dist/root/lib
docker build -f ./libopenssl/Dockerfile -t playground-php-wasm:libopenssl-1.1.1 . --build-arg OPENSSL_VERSION=1.1.1t
mkdir -p ./libopenssl/asyncify/dist/1.1.1/root/lib
docker cp $$(docker create playground-php-wasm:libopenssl-1.1.1):/root/install/lib ./libopenssl/asyncify/dist/1.1.1/root/lib
docker cp $$(docker create playground-php-wasm:libopenssl-1.1.1):/root/install/include ./libopenssl/asyncify/dist/1.1.1/root/lib

libopenssl_jspi: libopenssl/jspi/dist/1.1.0h/root/lib/lib/libssl.a libopenssl/jspi/dist/1.1.1/root/lib/lib/libssl.a

libopenssl/jspi/dist/1.1.0h/root/lib/lib/libssl.a: base-image libz_jspi
mkdir -p ./libopenssl/jspi/dist/root/lib
docker build -f ./libopenssl/Dockerfile -t playground-php-wasm:libopenssl-1.1.0h . --build-arg JSPI=1 --build-arg OPENSSL_VERSION=1.1.0h
mkdir -p ./libopenssl/jspi/dist/1.1.0h/root/lib
docker cp $$(docker create playground-php-wasm:libopenssl-1.1.0h):/root/install/lib ./libopenssl/jspi/dist/1.1.0h/root/lib
docker cp $$(docker create playground-php-wasm:libopenssl-1.1.0h):/root/install/include ./libopenssl/jspi/dist/1.1.0h/root/lib

libopenssl_jspi: libopenssl/jspi/dist/root/lib/lib/libssl.a
libopenssl/jspi/dist/root/lib/lib/libssl.a: base-image libz_jspi
libopenssl/jspi/dist/1.1.1/root/lib/lib/libssl.a: base-image libz_jspi
mkdir -p ./libopenssl/jspi/dist/root/lib
docker build -f ./libopenssl/Dockerfile -t playground-php-wasm:libopenssl . --build-arg JSPI=1
docker cp $$(docker create playground-php-wasm:libopenssl):/root/install/lib ./libopenssl/jspi/dist/root/lib
docker cp $$(docker create playground-php-wasm:libopenssl):/root/install/include ./libopenssl/jspi/dist/root/lib
docker build -f ./libopenssl/Dockerfile -t playground-php-wasm:libopenssl-1.1.1 . --build-arg JSPI=1 --build-arg OPENSSL_VERSION=1.1.1t
mkdir -p ./libopenssl/jspi/dist/1.1.1/root/lib
docker cp $$(docker create playground-php-wasm:libopenssl-1.1.1):/root/install/lib ./libopenssl/jspi/dist/1.1.1/root/lib
docker cp $$(docker create playground-php-wasm:libopenssl-1.1.1):/root/install/include ./libopenssl/jspi/dist/1.1.1/root/lib

libsqlite3_asyncify: libsqlite3/asyncify/dist/root/lib/lib/libsqlite3.a
libsqlite3/asyncify/dist/root/lib/lib/libsqlite3.a: base-image libz_asyncify
Expand Down
8 changes: 8 additions & 0 deletions packages/php-wasm/compile/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ const argParser = yargs(process.argv.slice(2))
description: 'The output directory',
required: true,
},
WITH_OPENSSL_VERSION: {
type: 'string',
choices: ['1.1.0h', '1.1.1'],
description: 'OpenSSL version to use',
default: '1.1.0h',
},
});

const args = argParser.argv;
Expand Down Expand Up @@ -185,6 +191,8 @@ await asyncSpawn(
'--build-arg',
getArg('PHP_VERSION'),
'--build-arg',
`OPENSSL_VERSION=${args.WITH_OPENSSL_VERSION || '1.1.0h'}`,
'--build-arg',
getArg('WITH_FILEINFO'),
'--build-arg',
getArg('WITH_LIBXML'),
Expand Down
8 changes: 3 additions & 5 deletions packages/php-wasm/compile/libopenssl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM playground-php-wasm:base

ARG JSPI=0
ARG OPENSSL_VERSION

RUN mkdir -p /root/lib/include /root/lib/lib
COPY ./libz/ /root/libz
Expand All @@ -13,23 +14,20 @@ RUN if [ "$JSPI" = "1" ]; then \
RUN /root/copy-lib.sh lib-libz
RUN set -euxo pipefail && \
source /root/emsdk/emsdk_env.sh && \
export OPENSSL_VERSION=1.1.0h && \
wget https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz && \
tar xf openssl-$OPENSSL_VERSION.tar.gz && \
cd openssl-$OPENSSL_VERSION && \
emconfigure ./Configure dist -DHAVE_FORK=0 -DOPENSSL_NO_AFALGENG=1 no-threads --prefix=/root/install;
emconfigure ./Configure -DHAVE_FORK=0 -DOPENSSL_NO_AFALGENG=1 no-threads --prefix=/root/install linux-generic32;

RUN source /root/emsdk/emsdk_env.sh && \
export OPENSSL_VERSION=1.1.0h && \
cd openssl-$OPENSSL_VERSION && \
sed -i 's|^CROSS_COMPILE.*$|CROSS_COMPILE=|g' Makefile && \
export JSPI_FLAGS=$(if [ "$JSPI" = "1" ]; then echo "-sSUPPORT_LONGJMP=wasm -fwasm-exceptions"; else echo ""; fi) && \
EMCC_FLAGS=" -sSIDE_MODULE $JSPI_FLAGS" EMCC_SKIP="-lz" emmake make -j 12 build_generated libssl.a libcrypto.a;

RUN source /root/emsdk/emsdk_env.sh && \
export OPENSSL_VERSION=1.1.0h && \
cd openssl-$OPENSSL_VERSION && \
export JSPI_FLAGS=$(if [ "$JSPI" = "1" ]; then echo "-sSUPPORT_LONGJMP=wasm -fwasm-exceptions"; else echo ""; fi) && \
cp -RL include/openssl /root/lib/include && \
cp libcrypto.a libssl.a /root/lib/lib && \
EMCC_FLAGS=" -sSIDE_MODULE $JSPI_FLAGS" EMCC_SKIP="-lz" emmake make install_sw;
EMCC_FLAGS=" -sSIDE_MODULE $JSPI_FLAGS" EMCC_SKIP="-lz" emmake make install_sw || true;
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ extern "C" {
* The following are cipher-specific, but are part of the public API.
*/
#if !defined(OPENSSL_SYS_UEFI)
# undef BN_LLONG
# define BN_LLONG
/* Only one for the following should be defined */
# undef SIXTY_FOUR_BIT_LONG
# undef SIXTY_FOUR_BIT
# define THIRTY_TWO_BIT
#endif

#define RC4_INT unsigned int
#define RC4_INT unsigned char

#ifdef __cplusplus
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Name: OpenSSL-libcrypto
Description: OpenSSL cryptography library
Version: 1.1.0h
Libs: -L${libdir} -lcrypto
Libs.private:
Libs.private: -ldl
Cflags: -I${includedir}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/

#ifndef HEADER_AES_H
# define HEADER_AES_H

# include <openssl/opensslconf.h>

# include <stddef.h>
# ifdef __cplusplus
extern "C" {
# endif

# define AES_ENCRYPT 1
# define AES_DECRYPT 0

/*
* Because array size can't be a const in C, the following two are macros.
* Both sizes are in bytes.
*/
# define AES_MAXNR 14
# define AES_BLOCK_SIZE 16

/* This should be a hidden type, but EVP requires that the size be known */
struct aes_key_st {
# ifdef AES_LONG
unsigned long rd_key[4 * (AES_MAXNR + 1)];
# else
unsigned int rd_key[4 * (AES_MAXNR + 1)];
# endif
int rounds;
};
typedef struct aes_key_st AES_KEY;

const char *AES_options(void);

int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
AES_KEY *key);
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
AES_KEY *key);

void AES_encrypt(const unsigned char *in, unsigned char *out,
const AES_KEY *key);
void AES_decrypt(const unsigned char *in, unsigned char *out,
const AES_KEY *key);

void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
const AES_KEY *key, const int enc);
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, const int enc);
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc);
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc);
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc);
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num);
/* NB: the IV is _two_ blocks long */
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, const int enc);
/* NB: the IV is _four_ blocks long */
void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
const AES_KEY *key2, const unsigned char *ivec,
const int enc);

int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
unsigned char *out,
const unsigned char *in, unsigned int inlen);
int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
unsigned char *out,
const unsigned char *in, unsigned int inlen);


# ifdef __cplusplus
}
# endif

#endif
Loading
Loading