feat(image): run the Directus 8.8.1 core on PHP 8.5 as a base image #1
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/DI-1-port-directus-8-core-to-php-85-and-publish-base-im"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Art of Sports, JVDV and Tuinen Daan all run Directus 8.8.1 on PHP 7.4. Since php2shell (CVE-2026-109618, CVE-2026-109619), all three are offline, because PHP 7.4 gets no fix. This PR makes the Directus 8.8.1 core run on PHP 8.5.12, which carries the fix. It is packaged as one base image,
git.pienter.space/pienter/directus-v8. Each site will buildFROMit and add only its own config, custom extensions, env and upload paths, so the next PHP fix is one rebuild here plus a tag bump per site. Directus version, schema, admin app and REST API stay the same, except that the unused GraphQL endpoint is removed. Abandoned or outdated libraries are replaced or upgraded (Swift Mailer → Symfony Mailer, php-jwt 7, Phinx 0.16). Three upstream token-forgery holes are closed, the worst of which let anyone log in as any user.For you
psr/simple-cacheis required as"2.0.0 as 1.0.1"(composer.json:43). Phinx 0.16's cakephp/database needs simple-cache 2, whilecache/adapter-common1.3 (latest) still declares^1.0. 2.0 only adds parameter types; every cache pool loads and works.composer validatewarns about the alias. Accepted in DI-1.encryptionnow means STARTTLS when offered; Swift sent plaintext. For SES, settls.php -vand/server/pingcheck on it.docker login git.pienter.space, then the buildx push in README.md:215. Check that the package is public with an anonymousdocker pull.Review guide
1. Runtime image. Directus 8 resolves its base path from
src/web.php, so the core stays at the image's project root, and consumers copy their files into the same tree.runtimestage: pinnedphp:8.5.12-apache-trixie, with the same extensions, Apache modules anddocker/config as the AOS image. curl and mbstring are already built into the official image.composer install --no-dev --optimize-autoloader, without a classmap-authoritative autoloader, so consumer classes underpublic/extensions/customstill autoload through PSR-4.display_errors=Off, and deprecations go to the log. Without this, PHP 8.5 notices broke the JSON responses, including/server/ping.public/uploads/_are created and owned bywww-data. Consumers with other paths (JVDVjvdv-api, TNDtnd) must create their own.2. PHP 8 breaks in the zend-db fork. These are real 500s found on the AOS DB copy, not lint findings.
vsprintfgets(array), andcountfollows PHP 7 semantics for scalars and null. This fixed aTypeErroronitems?meta=*(countByStatus).zend-stdlibdependency is gone.Sql/Ddl/Column/Float.phpis deleted:Floatis a reserved class name, so the file could never load. It was the only lint fatal.count()fallback (null → 0, scalar → 1) matches PHP 7.4 for every$paramSpecskey that reaches it.3. PHP 8 breaks in the core.
call_user_func_array($listener, array_values($data)). PHP 8 reads string keys as named arguments, which madePOST /_/filesfail with "Unknown named parameter $name".array_valueskeeps that order.4. Dependencies.
"php": "^8.5", plus Guzzle 6.5 → 7.16, symfony/validator 3.4 → 5.4, splitcache/*1.x adapters instead of the PHP 7-only monolith, ip-address-middleware 1.0 → 2.6, and the latest compatible minor everywhere else.Client::post/request, which is unchanged in 7. Anything relying on Guzzle 6 internals (GuzzleHttp\Psr7\functions) would break.5. Token verification (security). Upstream only base64-decoded several tokens and trusted their claims. A control run of the old code issued an admin token for a forged, unsigned SSO request token.
authenticateWithSsoRequestToken: the publicPOST /auth/sso/access_tokennow verifies signature and expiry viaProvider::getTokenPayloadbefore issuing an access token for$payload->id.enableUserWithInvitationand AuthService.php:436resetPasswordWithToken: same verification. A forged invite token used to activate a pending invite.refreshToken: verifies first, so malformed tokens get 401 instead of a 500.getTokenPayloadis now public; it is the core's existing verify path (project secret, HS256, origin check).6. Mail: Swift Mailer → Symfony Mailer. Swift Mailer was abandoned in 2021. All sites will send through Amazon SES over SMTP, configured only through the existing
mail.default.*keys /DIRECTUS_MAIL_DEFAULT_*env.Message extends Emailand keeps the Swift-style setters hooks use (setTo,setFrom,setReplyTo, setBody:97, addPart:123).ssl= implicit TLS,tls= required STARTTLS.MailNotSentException, so reset, invite and/mailno longer return the SMTP reply and username.Swift_*classes, Swift'saddTo($addr, $name)) break. AOS's SES helper does; AOS-9 replaces it with the core helpers.7. GraphQL removed. Unused by the admin app and every frontend, and it carried three advisories with fixes only in graphql-php 15.
src/endpoints/GraphQL.php,src/core/Directus/GraphQL/(29 files),GraphQLService, the/gqlroute insrc/web.phpand its cache branch inResponseCacheMiddleware./gqlanswers 404.8. php-jwt 7 and Phinx 0.16.
new Key($key, $alg); :57 casts the payload to array (refresh passes a stdClass). Secrets must be ≥32 bytes.->save()afterdrop(), which only queues since 0.10.Level::cases(); log file names are unchanged.Skim:
app/and the upstream example extensions removed (the old 2022 tree).packages/*/composer.json: php constraint and explicit versions.packages/directus-*(9 packages, 178 files) deleted: unused copies, not in composer repositories, require or autoload.composer.lock,.gitignore,.dockerignore.README.md: consumer contract, tag scheme<directus>-php<php>[-r<n>], auth-secret rule,## Mail(env keys, SES,MessageAPI), build and publish.AGENTS.md,ws.toml,docs/agents/issue-tracker.md: WindshiftDI.LICENSE.md.Evidence
Before: on PHP 8.5 without the fixes,
GET items/<collection>?meta=*returned 500 (TypeErrorinAbstractSql) forpages,header,top_headerandGroup_Training_Types.POST /_/filesreturned 500 ("Unknown named parameter $name")./server/pingresponses carried deprecation notices.After:
git.pienter.space/pienter/directus-v8:8.8.1-php8.5.12, built locally and run against a MariaDB 10.11 copy of the AOS database./server/inforeports PHP 8.5.12, Directus 8.8.1. Head61f664a: smoke 77/77, smoke2 89/89 and flows 38/38, in production and development mode; the throwaway AOS consumer passes the same. First commit: 75/75 and 89/89./server/ping, and the admin app with its static assets.Contact_Form_Responsesanddirectus_users./_/assets; an existing AOS media thumbnail./gql→ 404.db:upgradeon the AOS copy: applies nothing.install:database,install:install) on an empty MariaDB: schema, system data and 79 migration rows identical to the Phinx 0.9 image; the full upgrade path too.alg: none, wrong type, signed but expired) → 401 with each endpoint's existing error, and no state change. Garbage refresh tokens → 401./mailreturn the generic 503 mail error with no SMTP text; the log has the TransportException.AuthService: forged SSO tokens got 200 with an admin token (35/38), so the tests catch the hole.FROMthis tag plus AOS'sconfig/andpublic/extensions/custom) passes the same sets. AOS's custommailendpoint, its SES contact hook and its Dokploy rebuild hook all loaded and ran up to their missing env vars.docker buildsucceeds.php -lon 2921 PHP files: 0 failures.composer validatevalid (alias and@devpath warnings);composer auditlists only the ignored flysystem advisory.E_WARNING(src/helpers/file.php:138undefinedprivate_hash, a notice on 7.4).install:configon a fresh checkout (it fails the same way on 7.4).Tests: none in the repo; the smoke scripts were throwaway.
Merge Danger
Door: two-way
Merging publishes nothing and deploys nothing. The image push is a separate manual step, and no site uses this repo yet.
Blast Radius: none-yet
Once AOS-9, JVDV-10 and DVPL-2 build
FROMthe tag, a defect here reaches all three sites. The image breaks AOS's Swift-based contact notification and short auth secrets, so each site moves only together with its consumer task. Tags are immutable (-r<n>for rebuilds), so each site can pin back to the tag it used before.