Problem/Motivation
When visiting an uninstalled site and running PHP 7, PHP 7 catches a invalid shift.
ArithmeticError: Bit shift by negative number in Drupal\Core\Routing\RouteProvider->getCandidateOutlines()
Technically a fatal error but this already does a fatal error a couple lines later in getRoutesByPath() when it tries to query a non-existent table so not going to bump the priority.
The problem is that, without config, the frontpage resolves to an empty string which gets resolved to a length "-1." When
we shift by $length on line 282 we shift by a negative number and we get the fatal.
Proposed resolution
IRC discussion with Dawehner decided that its probably best to fix the frontpage resolution to always resolve _something_ and then also fix the outline code to not fatal.
Remaining tasks
Resolve what the fallback frontpage should be when not installed.
Resolve what getCandidate
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#12 | 2616498-12.patch | 5.86 KB | neclimdul |
#12 | 2616498-12.interdiff.txt | 1.28 KB | neclimdul |
Comments
Comment #2
neclimdulPatch to show the error.
Comment #4
neclimdulThe 5.x fail actually holds a clue. This was wrong all along but not the shift, the bug is in the optimized mask generations. Lets look at the code:
We're focused on the 2nd and 3rd cases. The first case matches everything less then 2nd matches everything <= 3 and the second matches everything <= 0. Obviously the 3rd if never gets matched but its important that it does. It exists because when $end <= 0 assumptions fall apart and and the safe guards in mask loop that happens next fail.
Because the optimized version of the mask generation doesn't exist in 7, its not affected and this is only a 8.x problem.
Comment #5
neclimdulComment #6
dawehnerShould we still fix the potential bug in the FronPathProcessor?
Comment #7
neclimdulComment #9
neclimdulForgot the comment sorry. So the idea here is we want to make sure we only return routeable paths. So thinking about what an empty config return means, we have 2 possibilities.
So, I think the options are to hard code a fallback or throw an exception. Since broken config is going to cause the site to be broken anywhere else, I went with throwing the exception in this patch. Lets see what the rest of the test suite thinks about it.
Comment #11
dawehnerWe should add a line of documentation why we do things here.
Comment #12
neclimdulApparently the failure was @group missing. The failure return code broke something in drupalci and something something so the message was lost but Mixologic committed a fix and people shouldn't see it in the future.
Added some docs and fixed the test.
Comment #13
Mixologicadded a retest in #7 to see if the commit, did, indeed fix it. We should now see something else.
Comment #15
MixologicOnce again, this time with more feeling.
Comment #17
MixologicGit push --tags makes the tag actually there.
Comment #19
dawehnerGreat, thank you!
Comment #20
Crell CreditAttribution: Crell as a volunteer commented+1 from me, thanks!
Comment #21
catchCommitted/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!