This repository was archived by the owner on May 29, 2026. It is now read-only.
fix: guard against null return from find() in PATCH path of updateFromArray#1346
Merged
bbrands02 merged 1 commit intoApr 24, 2026
Merged
Conversation
…mArray objectService->find() returns ?ObjectEntity. When the target object does not exist — unknown ID, wrong register/schema scope, or RBAC denial — find() returns null and the unconditional getObject() call produces a fatal TypeError, surfacing as an unhandled 500. Add an explicit null check and throw ValidationException so callers receive a clear, actionable error instead of a cryptic fatal. Using a uniform error message for both "not found" and "not accessible" also prevents ID enumeration through differing error signatures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
WilcoLouwerse
approved these changes
Apr 24, 2026
Contributor
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| composer | ✅ | ✅ 147/147 | |||
| npm | ✅ | ✅ 599/599 | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-04-24 11:52 UTC
Download the full PDF report from the workflow artifacts.
rjzondervan
approved these changes
Apr 24, 2026
Merged
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
objectService->find()returns?ObjectEntity(nullable). InupdateFromArray(), when$patch === true, the result was dereferenced unconditionally via$existing->getObject(). If the target object does not exist — unknown ID, wrong register/schema scope, or RBAC denial —find()returnsnulland the call produces a fatalTypeError, surfacing as an unhandled 500.The fix adds an explicit null check immediately after
find()and throwsValidationExceptionwith a clear message. Using a uniform message for both "not found" and "not accessible" also prevents ID enumeration through differing error signatures.Reported in code review by @WilcoLouwerse.
Test plan
ValidationExceptionis thrown (no unhandled 500)ValidationExceptionis thrown rather than a fatal TypeErrorObjectServiceMapperAdapterand confirm no regressions🤖 Generated with Claude Code