Fix element booting, holder writes, db path names and invalid route expressions - #672
Open
samuelpatro wants to merge 2 commits into
Open
samuelpatro wants to merge 2 commits into
samuelpatro wants to merge 2 commits into
Conversation
…d route expressions ElementBase never called Extendable::__construct, so extend() callbacks and $implement were ignored on construction but applied on unserialize. ElementHolder::get served a value cached by an earlier read after offsetSet had replaced it. DbDatasource::pathToFileName removed every occurrence of the directory name instead of the leading one. Router and Rule accepted a URL when a parameter expression threw instead of rejecting it.
samuelpatro
marked this pull request as ready for review
August 30, 2026 11:29
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.
Four unrelated correctness bugs, one commit. Each has a test that fails on
develop.src/Element/ElementBase.php—__construct()never calledparent::__construct(), soExtendable::extendableConstruct()did not run:SomeElement::extend(fn)callbacks and$implementbehaviors were ignored for constructed elements, but applied by__wakeup()for unserialized ones. Added the parent call. Test:tests/Element/ElementBaseTest.php(testExtendCallbackIsAppliedOnConstruction,testImplementedBehaviorIsApplied).src/Element/ElementHolder.php—get()returned$touchedElements[$key]if present, so a value read once was returned forever even after$holder['key'] = 'new'wrote to$config.get()now reads$configand records the touch; addedoffsetUnset()that also clears the touch. Test:testHolderReturnsWrittenValueAfterRead.src/Halcyon/Datasource/DbDatasource.php—pathToFileName()usedstr_replace($dirName, '', $path), removing every occurrence:pages/pages/about.htm→about.htm. Now strips only a leading$dirName/. Test:tests/Halcyon/Datasource/DbDatasourceTest.php::testPathToFileNameStripsOnlyTheDirectoryPrefix.src/Router/Router.php,src/Router/Rule.php— thepreg_matchon a:param|regexsegment sat intry { } catch (Exception) { }with an empty catch. When the expression is invalid, PHP emits a warning; under Laravel's error handler that is anErrorException, which was swallowed, leaving$valid = true(Router) or falling through toreturn true(Rule). A malformed route expression therefore matched any value. Both now treat the exception as a non-match. Tests:tests/Router/RouteTest.php(testInvalidParameterExpressionFailsClosed,...OnRule) install a throwing error handler and assert the URL does not match.