Repository navigation
Fix PHP 8.5 deprecations in backend, CMS and system modules - #1609
Conversation
…igation code Running on PHP 8.5 logs deprecations from these spots on ordinary backend requests: - NavigationManager::getContextOwner(): null used as an array offset when no context owner is set - FormField::evalConfig(): strtolower(null) when a field has no type - RelationController::relationRender(): strtolower(null) when no section option is passed - Lists::evalTextTypeValue(): htmlentities(null) for empty column values - FormController create/update/preview: strlen(null) when no context is passed Each now treats null the way it was already treated before (an empty string, or no owner). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. WalkthroughBackend, CMS, and system methods now cast values before string operations or check for null values before lookup or file checks. Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk:
|
- config/database.php: PDO::MYSQL_ATTR_SSL_CA is deprecated in PHP 8.5 and was logged on every request using the mysql connection. Use Pdo\Mysql::ATTR_SSL_CA on PHP 8.5+, the same check the Laravel skeleton uses. - PluginManager::getActiveReplacementMap(): null used as an array offset for any plugin that doesn't replace another (hit by the Updates page and UpdateManager for every plugin). - Backend Controller::execAjaxHandlers(): trim(null) on every backend AJAX request without an X_WINTER_REQUEST_PARTIALS header. - Repeater::processItems(): starts_with(null) on non-AJAX requests, where there is no AJAX handler. - MediaManager::prepareVars(): strlen(null) when no search term is set. - MyAccount::update_onSave(): strlen(null) when no new password is posted. - MailSetting::initSettingsData(): strlen(null) when no SMTP username is configured. - CMS Index controller: pathinfo(null) for a new template without a file name. - CmsCompoundObject::beforeSave(): str_replace() on a null original code value when creating a template with code. - ComponentManager::makeComponent(): class_exists(null) for soft components that aren't installed. - Theme::getActiveThemeCode(): strlen(null) when no theme is active. - PackageJson: File::exists(null) when constructed without a path. Each null is treated as before (an empty string, or no match). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m tests setAccessible() has had no effect since PHP 8.1 (the minimum supported version) and is deprecated in PHP 8.5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes PHP 8.5 deprecations that fire on ordinary requests. Found on a production site running PHP 8.5, then by running the full test suite on PHP 8.5 with every deprecation logged at its call site (1243 tests pass).
Each null is treated the way it already was (an empty string, or no match), so behaviour is unchanged.
Null passed to string functions / used as an array offset
NavigationManager::getContextOwner(): null array offset when no context owner is setFormField::evalConfig():strtolower(null)when a field has no type (overlaps with the guard in Fix deprecation notices in the backend module #1490)RelationController::relationRender():strtolower(null)when nosectionoption is passedLists::evalTextTypeValue():htmlentities(null)for empty column valuesFormControllercreate/update/preview:strlen(null)when no context is passedPluginManager::getActiveReplacementMap(): null array offset for every plugin that doesn't replace another (Updates page, UpdateManager)Controller::execAjaxHandlers():trim(null)on every AJAX request withoutX_WINTER_REQUEST_PARTIALSRepeater::processItems():starts_with(null)on non-AJAX rendersMediaManager::prepareVars():strlen(null)with no search termMyAccount::update_onSave():strlen(null)when no new password is postedMailSetting::initSettingsData():strlen(null)with no SMTP username (the default)Indexcontroller:pathinfo(null)for a new template without a file nameCmsCompoundObject::beforeSave():str_replace()on a null originalcodeComponentManager::makeComponent():class_exists(null)for soft components that aren't installedTheme::getActiveThemeCode():strlen(null)when no theme is activePackageJson:File::exists(null)when constructed without a pathRemoved or replaced APIs
config/database.php:PDO::MYSQL_ATTR_SSL_CA→Pdo\Mysql::ATTR_SSL_CAon PHP 8.5 (same check as the Laravel skeleton). This one is logged on every request using the mysql connection. Supersedes the closed php8.5 deprecated issue PDO::MYSQL_ATTR_SSL_CA in config/database.php #1606.setAccessible(true)calls (deprecated in 8.5, a no-op since 8.1)Since
System\ServiceProvider::registerLogging()writes every log message tosystem_event_logs, each of these also cost a database insert per occurrence.Not fixed here: deprecations inside Laravel 9 vendor code (
InteractsWithIOnull verbosity offset,str_getcsv()without$escapeinValidationRuleParser,setAccessible()inHigherOrderTapProxy) and inwinter/laravel-config-writer(ArrayPrinter.php:286null offset, implicitly nullable parameters).🤖 Generated with Claude Code
Summary by CodeRabbit