Skip to content

fix: skip env overrides for anonymous BaseConfig subclasses on PHP 8.6 - #10804

Merged
paulbalandan merged 1 commit into
codeigniter4:4.8from
paulbalandan:config-anonymous-class-env
Nov 23, 2026
Merged

paulbalandan merged 1 commit into
codeigniter4:4.8from
paulbalandan:config-anonymous-class-env

Conversation

@paulbalandan

Copy link
Copy Markdown
Member

Description
Depends on #10685 to be tested.

An anonymous BaseConfig subclass has a NUL byte in its class name. The env override lookup builds getenv() names from that class name, and PHP 8.6 now throws a ValueError for a name containing a NUL byte. Before 8.6, getenv() cut the name at the NUL byte, so such a class never received overrides.

BaseConfig::__construct() now returns before the env lookup when the class name contains a NUL byte. Registrars still run, and the property values are unchanged.

The test compares SimpleConfig, which gets the .env override, with an anonymous subclass, which keeps its default and no longer throws.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@paulbalandan
paulbalandan marked this pull request as draft November 20, 2026 14:53
@carson-codeigniter4 carson-codeigniter4 Bot added 4.8 PRs that target the `4.8` branch. bug Verified issues on the current code behavior or pull requests that will fix them labels Nov 20, 2026
@paulbalandan
paulbalandan marked this pull request as ready for review November 20, 2026 14:57
@paulbalandan
paulbalandan merged commit e3bf470 into codeigniter4:4.8 Nov 23, 2026
54 checks passed
@paulbalandan
paulbalandan deleted the config-anonymous-class-env branch November 23, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.8 PRs that target the `4.8` branch. bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants