Repository navigation
Remove incorrect assert() in _lcsPos() - #8
Merged
ralflang merged 1 commit intoNov 13, 2026
Merged
Conversation
On PHP 8 assert() throws AssertionError in production, aborting diff rendering. The condition can legitimately be true when the text has repeated lines; the code right below already handles that case, so the assertion is simply wrong. The assert originates from the original Algorithm::Diff port; the Perl original has no such check.
Member
|
Thank you. I will follow up with a test case. |
|
Review: Worth merging only as a crash stop, and only with a comment of the same kind as the disabled assertion above it, pointing at bug 14738. The commit message is wrong on three points: the failing condition is equality ($ypos == $this->seq[$end]), the lines below do not handle that case, and the check is not absent from the algorithm this function was taken from because it was simply mistaken. It guards the strictly increasing seq invariant. I would not call this correct until _diag() stops writing a y-index into seq[$k] when that index is already stored at another slot. The $k initialization in 216be5b does not do that. FYI @ralflang |
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.
On PHP 8 assert() throws AssertionError in production, aborting diff rendering. The condition can legitimately be true when the text has repeated lines; the code right below already handles that case, so the assertion is simply wrong. The assert originates from the original Algorithm::Diff port; the Perl original has no such check.