Skip to content

fix(php85): eliminate every deprecation, and fail the build on a new one - #197

Merged
WebTigers merged 1 commit into
mainfrom
fix/php85-deprecations
Aug 29, 2026
Merged

fix(php85): eliminate every deprecation, and fail the build on a new one#197
WebTigers merged 1 commit into
mainfrom
fix/php85-deprecations

Conversation

@WebTigers

Copy link
Copy Markdown
Owner

The suite reported 15 deprecations on PHP 8.5, tolerated rather than fixed. Two of these classes are not cosmetic — implicitly nullable parameters become a fatal in PHP 9.

Fixed at the source. Nothing suppressed.

Deprecation Sites Fix
Implicit nullable param 2 (vendored Parsedown) array $Block = null?array $Block = null
Implicit nullable param 1 (Zend_View::renderString) shipped as TigerZF v1.32.2; floor here → ^1.32.2
curl_close() — no-op since 8.0 12 removed
imagedestroy() — no-op since 8.0 2 removed
setAccessible() — no-op since 8.1 10 removed

Beyond the 15 reported

The suite only reaches the paths it covers. I fixed the whole class, not the sample:

  • curl_close() — the tests hit 1 of 12 call sites. The other 11 (Recaptcha, Aws location, all three agent providers, register, the MCP bridge) would have fired in production.
  • setAccessible() — 9 were in tests, but one was in Application/Bootstrap, production code the suite never exercises.

Every curl_close() removal was checked to read curl_getinfo/curl_error before the call, so removal is behaviour-preserving. ?array is exactly what implicit nullable already meant.

Vendored code

Parsedown is third-party, so the patch is recorded in a LOCAL MODIFICATIONS header block naming both signatures — otherwise the fix silently disappears on a re-vendor.

The ratchet

failOnDeprecation="true" in phpunit.xml, so a new deprecation fails the build by exit code rather than being printed and ignored.

Verified it actually bites rather than assuming: reintroducing the Parsedown signature → exit 1; restoring it → exit 0. (The summary line still reads "OK, but there were issues!" — the signal is the exit code, which is what CI gates on.)

Result

OK (2111 tests, 21490 assertions) — clean green, zero deprecations.

The suite reported 15 deprecations on PHP 8.5. They were tolerated rather than fixed, which meant
new ones could accumulate unnoticed — and two of these classes are not cosmetic: implicitly
nullable parameters become a FATAL in PHP 9.

Fixed at the source, never suppressed:

- **Implicit nullable params** — `array $Block = null` -> `?array $Block = null` in the vendored
  Parsedown (2 signatures). `?array` is exactly what the implicit form already meant, so behaviour
  is identical. Parsedown is third-party, so the change is documented in a LOCAL MODIFICATIONS
  header block; re-apply it if the library is ever re-vendored. The matching Zend_View one shipped
  separately as TigerZF v1.32.2 (the floor here moves to ^1.32.2 so consumers actually get it).

- **`curl_close()`** — a no-op since PHP 8.0 (the handle is an object freed by refcount),
  deprecated in 8.5. Removed at ALL 12 call sites, not only the one the tests happened to reach:
  Recaptcha, Google/Analytics (x2), Location/Adapter/Aws, Agent/Provider/{Gemini,OpenAiCompatible,
  Anthropic} (x2 each), register/Registration, and bin/mcp-bridge. Every one read curl_getinfo /
  curl_error BEFORE the call, so removal is behaviour-preserving.

- **`imagedestroy()`** — same story (GdImage is an object since 8.0). Removed from Media/Image,
  with a note that the memory is released at exactly the points it always was: `$dst` when the next
  loop iteration reassigns it, `$src` when the scope ends.

- **`ReflectionProperty/Method::setAccessible()`** — a no-op since PHP 8.1. Removed from 9 test
  sites AND from Application/Bootstrap, which the suite never exercised — most of the codebase had
  already been cleaned, these were the stragglers.

Then the ratchet: `failOnDeprecation="true"` in phpunit.xml, so a NEW deprecation fails the build
by exit code instead of being reported and ignored. Verified both ways — reintroducing the
Parsedown signature makes the run exit 1, restoring it exits 0.

Full suite: OK (2111 tests, 21490 assertions) — clean green, zero deprecations.
@WebTigers
WebTigers merged commit c685bbd into main Aug 29, 2026
13 checks passed
@WebTigers
WebTigers deleted the fix/php85-deprecations branch August 29, 2026 06:56
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.

1 participant