|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests |
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 17:00:01 2025 UTC |
Description: ------------ When comparing two strings using xdiff_string_diff, on any added line groups (one side with new lines, one side empty), the line number for the empty side is one less than what it should do. This caused me some headaches in working on a PHP web page where I was trying to parse and use these line number values for extracting lines which are common to both sides. I will likely need to workaround this by adding one to the line number if the corresponding length is zero. Using xdiff-2.1.0. Test script: --------------- echo xdiff_string_diff( "A\nA\nA\nB\nB\nB\nB\nC\nC\nC\nC\n", "A\nA\nA\nC\nC\nC\nC\n", 0); Expected result: ---------------- @@ -4,4 +4,0 @@ -B -B -B -B Actual result: -------------- @@ -4,4 +3,0 @@ -B -B -B -B