fix: guard against null keys/aliases to fix PHP 8.4 deprecation warnings#60752
Draft
miaulalala wants to merge 1 commit into
Draft
fix: guard against null keys/aliases to fix PHP 8.4 deprecation warnings#60752miaulalala wants to merge 1 commit into
miaulalala wants to merge 1 commit into
Conversation
edcebd1 to
1bb5354
Compare
- CappedMemoryCache: return early from get/hasKey/remove when key is null - QueryBuilder: coerce null alias to '' in join methods only, so DBAL does not receive null as an array key; quoteAlias() itself is unchanged so from() keeps its null-alias behaviour - user_ldap Access: guard null sndAttribute before using as array offset Signed-off-by: Anna Larch <anna@nextcloud.com> AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1bb5354 to
5194c38
Compare
Contributor
Author
|
/backport to stable34 |
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.
Summary
Fixes three PHP 8.4 deprecation warnings that surface as CI noise and will become failures on PHP 9:
CappedMemoryCache:get(),hasKey(), andremove()used null as an array offset when a caller passed a null key (e.g.AccountManager::getAccount()with a mock user whosegetUID()returns null). Guard each method with an early null return.QueryBuilder::quoteAlias(): returnednullwhen given a null alias, which then passed through to DBAL's join methods and triggeredarray_key_exists(null, ...)deprecations. Return''instead — DBAL treats an empty alias the same as null (no alias in the generated SQL). UpdatedQueryBuilderTestjoin expectations accordingly ('joinAlias' => null→'joinAlias' => '').user_ldap/Access:$sndAttributeis null whenldapUserDisplayName2is not configured (group path sets it to null explicitly), but was used as array offset inside the$isUsersbranch without a null check.Test plan
NOCOVERAGE=1 ./autotest.sh sqlite tests/lib/Accounts/AccountManagerTest.phpNOCOVERAGE=1 ./autotest.sh sqlite tests/lib/DB/QueryBuilder/QueryBuilderTest.php🤖 Generated with Claude Code