Skip to content

Test on PHP 7.4; fix jsonSerialize TypeError on PHP 7 - #95

Merged
TomK merged 1 commit into
masterfrom
php74
Nov 6, 2026
Merged

TomK merged 1 commit into
masterfrom
php74

Conversation

@TomK

@TomK TomK commented Nov 6, 2026

Copy link
Copy Markdown
Member

composer.json allows PHP ^7.2, but CI only runs 8.0+. Since 1.17.0, json_encode() of any DAO or DaoCollection throws on PHP 7, because jsonSerialize(): mixed reads mixed as a class name there:

TypeError: Return value of Packaged\Dal\Foundation\AbstractDao::jsonSerialize() must be an instance of Packaged\Dal\Foundation\mixed, array returned

  • json_encode() of a DAO or collection on PHP 7.4: returns the JSON again
  • PHP 8.x: unchanged; #[\ReturnTypeWillChange] (already present) keeps 8.1+ free of deprecation notices
  • CI: the matrix now includes PHP 7.4; actions/checkout bumped from v3 to v7

Test plan

  • PHPUnit on PHP 7.4 locally: 3 jsonSerialize TypeErrors before the change, none after. The remaining failing tests are the same set as on PHP 8.5, all environmental (memcache extension and DB services not running locally).

🤖 Generated with Claude Code

jsonSerialize() declared a `mixed` return type, which PHP 7 reads as a
class name, so json_encode() of any DAO or collection threw a TypeError.
Drop the native type; #[\ReturnTypeWillChange] keeps 8.1+ quiet. Add 7.4
to the test matrix and bump actions/checkout to v7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomK
TomK merged commit 7421785 into master Nov 6, 2026
7 checks passed
@TomK
TomK deleted the php74 branch November 6, 2026 11:27
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