Repository navigation
Fix CI_Cache dynamic property deprecation on PHP 8.2+ - #3472
Merged
magicbug merged 1 commit intoOct 1, 2026
Merged
Conversation
CI_Driver_Library loads drivers into undeclared properties (CI_Cache::$file, CI_Cache::$dummy), which PHP 8.2+ reports as "Creation of dynamic property ... is deprecated". Mark CI_Driver_Library and CI_Driver with #[AllowDynamicProperties], as already done for CI_Controller and CI_Loader. On PHP 7.x the attribute is parsed as a comment, and subclasses such as CI_Cache inherit it. Fixes magicbug#3146
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused change correctly resolves the reported deprecations without affecting supported older PHP versions.
Review effort: Balanced
Findings: None
What changed in this PR
Adds PHP 8.2+ compatibility for CodeIgniter driver classes, preventing dynamic-property deprecation notices.
Changes:
- Adds
#[AllowDynamicProperties]to both driver base classes. - Preserves PHP 7.x compatibility.
| File | Description |
|---|---|
system/libraries/Driver.php |
Allows intentional runtime driver properties. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3146
On PHP 8.2+ every page that loads the cache driver (dashboard, logbook, etc.) shows:
(and the same for
CI_Cache::$dummy). In development mode this is printed into the page, and as reported in #3146 it can also end up inside JSON responses and break saving QSOs.CI_Driver_Library::load_driver()stores each loaded driver in an undeclared property. This adds#[AllowDynamicProperties]toCI_Driver_LibraryandCI_Driver, the same fix already applied toCI_Controller,CI_Loader,CI_DB_driverandCI_Profiler.CI_Cacheinherits the attribute fromCI_Driver_Library.The attribute is a no-op comment on PHP 7.x, so nothing changes for older installs.
Testing
php -l system/libraries/Driver.phpon PHP 7.4.33 and 8.2.34CI_Driver_Libraryassigning$file/$dummy, asload_driver()does):