Skip to content

Comments

fix: Correct off-by-one error in ExecPlan countLines() method#397

Merged
yama merged 2 commits intofeature/refactor-log-systemfrom
copilot/sub-pr-393-yet-again
Feb 7, 2026
Merged

fix: Correct off-by-one error in ExecPlan countLines() method#397
yama merged 2 commits intofeature/refactor-log-systemfrom
copilot/sub-pr-393-yet-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 7, 2026

The countLines() method in the ExecPlan document was overcounting lines by 1 due to using feof() as the loop condition, which continues one iteration after EOF is reached.

Changes

  • Modified loop condition from while (!feof($handle)) to while (($line = fgets($handle)) !== false)
  • Ensures only lines actually read are counted
// Before: counts one extra line after EOF
while (!feof($handle)) {
    fgets($handle);
    $count++;
}

// After: counts only lines successfully read
while (($line = fgets($handle)) !== false) {
    $count++;
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: yama <73999+yama@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on manager log refactor plan fix: Correct off-by-one error in ExecPlan countLines() method Feb 7, 2026
Copilot AI requested a review from yama February 7, 2026 15:05
@yama yama marked this pull request as ready for review February 7, 2026 15:11
@yama yama merged commit c803a24 into feature/refactor-log-system Feb 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants