Skip to content
This repository was archived by the owner on May 30, 2025. It is now read-only.
This repository was archived by the owner on May 30, 2025. It is now read-only.

RawConnection->readTillPrompt() returns incomplete line #120

Description

@owre

readTillPrompt can sometimes return incomplete lines.

Given the input is ........\nsmb: \path\to\subfolder\>[space] and the first part of the input fills the buffer, so the $chunk variable will hold ........\nsmb: \path\to

Then strpos($chunk, "smb:") === false will cause the remaining \subfolder\>[space] to be left in the stream() and the next call to readTillPrompt return \subfolder\>[space]

But I would expect the function to have read until \>[space] the first call.

public function readTillPrompt() {
$output = "";
do {
$chunk = $this->readLine('\> ');
if ($chunk === false) {
return false;
}
$output .= $chunk;
} while (strlen($chunk) == 4096 && strpos($chunk, "smb:") === false);
return $output;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions