Support PHP 7.2 in Reprint exporter#335
Conversation
Pull pipeline performance —
|
| Stage | PR | trunk | Δ | Status | Details |
|---|---|---|---|---|---|
playground-sqlite-db-pull |
9.38 s | 9.08 s | ⚪ +305 ms (+3.4%) | ✓ | condition=db-pull in PHP.wasm runtime=php.wasm 8.3 wp_mysql_parser=enabled mode=lexer native_lexer=verified native_token_stream=WP_MySQL_Native_Token_Stream native_token_count=18 native_parser=selected trunk: condition=db-pull in PHP.wasm runtime=php.wasm 8.3 wp_mysql_parser=enabled mode=lexer native_lexer=verified native_token_stream=WP_MySQL_Native_Token_Stream native_token_count=18 native_parser=selected |
playground-sqlite-db-apply |
3.58 s | 3.52 s | ⚪ +59 ms (+1.7%) | ✓ | condition=db-apply to SQLite in PHP.wasm runtime=php.wasm 8.3 wp_mysql_parser=enabled mode=parser native_lexer=verified native_token_stream=WP_MySQL_Native_Token_Stream native_token_count=18 native_parser=verified native_ast=WP_MySQL_Native_Parser_Node sqlite_driver_parser=verified trunk: condition=db-apply to SQLite in PHP.wasm runtime=php.wasm 8.3 wp_mysql_parser=enabled mode=parser native_lexer=verified native_token_stream=WP_MySQL_Native_Token_Stream native_token_count=18 native_parser=verified native_ast=WP_MySQL_Native_Parser_Node sqlite_driver_parser=verified |
| Total | 12.96 s | 12.60 s | ⚪ +364 ms (+2.9%) |
Numbers carry runner noise; treat single-run deltas as directional, not authoritative.
📈 Trunk performance history — commit-by-commit timeline.
| - exporter_php: '7.2' | ||
| importer_php: '8.2' |
There was a problem hiding this comment.
The importer still only supports PHP>=7.4, which is why I separated exporter_php and importer_php versions
| timeout 30 php "$IMPORTER_PATH" preflight "${BASE}&directory=${DIR}" /tmp/e2e-smoke --secret="${SECRET}" 2>&1 | head -50 || echo "EXIT: $?" | ||
| preflight_output="$(timeout 30 "$IMPORTER_PHP" "$IMPORTER_PATH" preflight "${BASE}&directory=${DIR}" --state-dir="${STATE_DIR}" --fs-root="${FS_ROOT}" --secret="${SECRET}" 2>&1)" || { | ||
| status=$? | ||
| echo "$preflight_output" | head -50 | ||
| echo "EXIT: $status" | ||
| exit "$status" | ||
| } | ||
| echo "$preflight_output" | head -50 | ||
|
|
||
| echo "=== Importer files-pull ===" | ||
| timeout 30 php "$IMPORTER_PATH" files-pull "${BASE}&directory=${DIR}" /tmp/e2e-smoke --secret="${SECRET}" 2>&1 | head -50 || echo "EXIT: $?" | ||
| files_pull_output="$(timeout 30 "$IMPORTER_PHP" "$IMPORTER_PATH" files-pull "${BASE}&directory=${DIR}" --state-dir="${STATE_DIR}" --fs-root="${FS_ROOT}" --secret="${SECRET}" 2>&1)" || { | ||
| status=$? | ||
| echo "$files_pull_output" | head -50 | ||
| echo "EXIT: $status" | ||
| exit "$status" | ||
| } | ||
| echo "$files_pull_output" | head -50 |
There was a problem hiding this comment.
The old testing command ended with head -50 || echo "EXIT: $?", meaning we would only echo EXIT: $STATUS if head failed (which it basically never does). Importantly, the script would also not actually exit – it'd just echo EXIT: 1.
These changes trigger an actual failure if an error happens here.
| - | ||
| message: "#^Strict comparison using \\!\\=\\= between null and null will always evaluate to false\\.$#" | ||
| count: 1 | ||
| path: packages/reprint-exporter/src/class-file-tree-producer.php | ||
|
|
There was a problem hiding this comment.
class-file-tree-producer.php changed in a way that there is no longer an error to suppress
|
CI was passing on 518f4f5, so the more recent failures look like potential flukes |
| # via two PHPCompatibility runs (see lint:php:compat in composer.json). | ||
| - run: composer lint:php:compat | ||
|
|
||
| syntax-72: |
There was a problem hiding this comment.
Good call! This will prevent drift
The reprint-exporter package previously required PHP >=7.4, but the Jetpack plugin supports PHP >=7.2, so the PHP 7.2/7.3 test jobs could not install it. WordPress/reprint#335 added PHP 7.2 support, published as wp-php-toolkit/reprint-exporter v0.9.1 (php >=7.2). Bump the constraint from ^0.1.47 to ^0.9.1 and regenerate the lock; the transitive wp-php-toolkit/* dependencies move from v0.6.2 to v0.8.1. The exporter API used by Jetpack (Site_Export_HMAC_Server, Site_Export_HTTP_Server) is unchanged.
Background
Our initial strategy for shipping the Reprint exporter to Pressable sites is to include it in the stock Jetpack plugin. The Reprint exporter already lives in wpcomsh (which is part of Jetpack), so the tactic is:
One obvious concern here is, "Is it really good UX to deploy this through Jetpack?" The answer is that we are doing this to support Studio sync, which already depends on Jetpack for Pressable sites to work, and Jetpack also gives us auth. Long-term, it is very likely there'll be a standalone Reprint exporter plugin, just not to begin with.
What is this PR?
The standard Jetpack plugin supports PHP 7.2. To be able to include the Reprint exporter there, we need to update the Reprint exporter code to work with PHP 7.2 This PR does just that.
The client is not affected. You can still use newer PHP syntax and features there.
Testing instructions
CI should pass