Repository navigation
Placeholder for a deleted record; throw instead of E_USER_ERROR (#5, #6) - #17
Merged
Merged
Conversation
…on (#6) Fails on the current code: byID() returns null for an ObjectID that no longer exists and shortcodePlaceHolder() calls hasMethod() on it ("Call to a member function hasMethod() on null"). Pair-programmed with my buddy Claude
…#5) Fails on the current code, which raises user_error(..., E_USER_ERROR); PHP 8.4 deprecates passing E_USER_ERROR to trigger_error(). Pair-programmed with my buddy Claude
#6) shortcodePlaceHolder() took the byID() result as is, so an ObjectID whose record no longer exists ended in a 500 (hasMethod() on null). The class singleton now answers, as it already did for a request without an ObjectID. Pair-programmed with my buddy Claude
#5) Pair-programmed with my buddy Claude
Pair-programmed with my buddy Claude
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.
Release 5.2.2.
shortcodePlaceHolder()falls back to the class singleton when theObjectIDrecord no longer exists, instead of callinghasMethod()onnull(500). Fixes Enhancement: handle a missing ObjectID in the placeholder #6.Shortcodable::register_class()throws aLogicExceptionwith the same message instead ofuser_error(..., E_USER_ERROR), which PHP 8.4 deprecates. Behaviour change for a misconfigured site: a catchable exception instead of a fatal error; every request still fails until fixed. README updated. Fixes Enhancement: throw instead of E_USER_ERROR in register_class() #5.Tests first, one commit per issue (a2ccc12, d4b235c). CI on the tests-only head d4b235c (run 41668994116) was red on exactly those two tests on all four legs (SS5 PHP 8.1/8.3, SS6 PHP 8.3/8.4); the other 40 passed. Locally on a Silverstripe 5 host (PHP 8.3): 2 errors before the fixes, 42/42 after.
Closes #5
Closes #6
Pair-programmed with my buddy Claude