Skip to content

Remove incorrect assert() in _lcsPos() - #8

Merged
ralflang merged 1 commit into
horde:FRAMEWORK_6_0from
bearoff:fix/native-engine-lcspos-assert
Nov 13, 2026
Merged

ralflang merged 1 commit into
horde:FRAMEWORK_6_0from
bearoff:fix/native-engine-lcspos-assert

Conversation

@bearoff

@bearoff bearoff commented Nov 8, 2026

Copy link
Copy Markdown

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.

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.
@ralflang

Copy link
Copy Markdown
Member

Thank you. I will follow up with a test case.

@ralflang
ralflang merged commit 7c1124c into horde:FRAMEWORK_6_0 Nov 13, 2026
1 check passed
@ralflang
ralflang requested a review from TDannhauer November 13, 2026 10:09
ralflang added a commit that referenced this pull request Nov 13, 2026
@TDannhauer

Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants