You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6f803f6
Browse filesBrowse the repository at this point in the historyBrowse files
> **Stacked on #3501** (Add PHP 5.2 WebAssembly builds and runtime
support). Review that PR first.
## Summary
Boot legacy WordPress (1.0 – 6.2) in the browser, with SQLite as the
database.
<img width="743" height="586" alt="Screenshot 2026-04-15 at 13 30 53"
src="https://github.com/user-attachments/assets/1c42ebab-cfb8-4968-88e8-b8a628a42515"
/>
The Playground settings panel gains an **"Include older versions"**
checkbox that exposes every WordPress release from 1.0 through 6.9 (with
jazz release code names) and auto-locks the PHP version to whatever runs
it.
Replaces and closes#3469 (the PHP 5.6 version of the same feature).
## What's in this PR
Builds on the PHP 5.2 WASM runtime from #3501 and adds:
- **Offline PHP 7+ → 5.2 downgrader** (`scripts/php52-downgrader/`) — a
nikic/PhpParser pipeline of ~20 visitors that strips modern syntax so
arbitrary PHP 7-era files parse on PHP 5.2.
- **SQLite plugin patcher** (`scripts/patch-sqlite-for-php52.mjs`) —
produces a PHP 5.2-compatible build of the upstream SQLite integration
plugin.
- **Legacy WordPress boot flow** (`wordpress/src/boot.ts`,
`legacy-wp-fixes.ts`, `mysql-shims.ts`) — legacy-aware installer path,
PDO table fallback for WP < 3.5, ~3400 lines of targeted source patches
for WP 1.0 – 2.8 parser/SQL quirks, auth/nonce compat, `wp-db.php`
SQLite compatibility, and more.
- **WP 5.0–6.2 on PHP 7.4** — extends the legacy boot to cover the
mid-modern range where PHP 8.x is unreliable.
- **Site settings UI** — "Include older versions" checkbox + grouped
dropdown + automatic PHP locking: WP 1.0 – 4.9 → PHP 5.2, WP 5.0 – 6.2 →
PHP 7.4, WP 6.3+ → default.
- **Release code names** — WP version picker shows jazz-musician
shorthand (e.g. "6.9 (Gene)", "4.9 (Tipton)").
- **TinyMCE content_css fix** — inlines editor CSS via `content_style`
to work around TinyMCE's `document.open()` creating a
service-worker-uncontrolled iframe.
## Test plan
### Automated (Playwright, all 32 legacy versions)
```bash
npm run dev
# Wait for http://localhost:5400/website-server/ to be ready
node packages/playground/wordpress/tests/test-legacy-wp-version-boot.mjs
```
Covers front page, single post, admin dashboard, new post page, and
plugin activation across every WP minor release from 1.0 to 6.2.
### Manual UI walk-through
1. `npm run dev` and open http://localhost:5400/.
2. Open the settings gear → tick **Include older versions**.
3. Verify the WP dropdown shows two groups and every release from 1.0 to
6.9.
4. Pick **WP 4.9** → PHP locks to 5.2 (disabled).
5. Pick **WP 5.5** → PHP locks to 7.4 (disabled).
6. Pick **WP 4.8**, go to Posts → Add New, verify TinyMCE loads without
CSS errors.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
0 commit comments