Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RawConnection->readTillPrompt() returns incomplete line #120

Open
owre opened this issue Aug 12, 2022 · 0 comments
Open

RawConnection->readTillPrompt() returns incomplete line #120

owre opened this issue Aug 12, 2022 · 0 comments

Comments

@owre
Copy link

owre commented Aug 12, 2022

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;
}

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

No branches or pull requests

1 participant