Skip to content

Support PHP 7.2 in Reprint exporter#335

Merged
adamziel merged 7 commits into
trunkfrom
f26d/exporter-php-72-support
Jul 10, 2026
Merged

Support PHP 7.2 in Reprint exporter#335
adamziel merged 7 commits into
trunkfrom
f26d/exporter-php-72-support

Conversation

@fredrikekelund

Copy link
Copy Markdown
Collaborator

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:

  1. Duplicate that implementation in the regular Jetpack plugin, gating the Reprint exporter feature to Pressable and WoA sites.
  2. After deploying that change, update the Reprint client to use the new Jetpack API URLs to interact with the Reprint exporter.
  3. Remove the wpcomsh Reprint exporter implementation from the Jetpack repo.

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

@fredrikekelund fredrikekelund self-assigned this Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Pull pipeline performance — large-directory

Site: large-directory · 2,000+ plus targeted file-transfer scenarios files · 10,000 posts · 25,000 postmeta · PHP 8.5.8

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.

Comment thread .github/workflows/e2e.yml
Comment on lines +40 to +41
- exporter_php: '7.2'
importer_php: '8.2'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The importer still only supports PHP>=7.4, which is why I separated exporter_php and importer_php versions

Comment thread .github/workflows/e2e.yml
Comment on lines -97 to +139
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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread phpstan-baseline.neon
Comment on lines -43 to -47
-
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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class-file-tree-producer.php changed in a way that there is no longer an error to suppress

@fredrikekelund

Copy link
Copy Markdown
Collaborator Author

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:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call! This will prevent drift

@adamziel
adamziel merged commit fd8d6bb into trunk Jul 10, 2026
27 of 30 checks passed
gcsecsey added a commit to Automattic/jetpack that referenced this pull request Jul 16, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants