Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 230ec57

Browse files
committed
FIX include line breaks in readLine
1 parent 96ec78e commit 230ec57

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

‎src/utils/StreamWrapper.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function readLine($eol = "\n")
104104
while (!$this->stream->eof()) {
105105
$pos = strpos($this->lastLine, $eol);
106106
if ($pos !== false) {
107-
$line = substr($this->lastLine, 0, $pos);
107+
$line = substr($this->lastLine, 0, $pos + $eolLen);
108108
$this->lastLine = substr($this->lastLine, $pos + $eolLen);
109109
return $line;
110110
}
@@ -113,7 +113,7 @@ public function readLine($eol = "\n")
113113

114114
$pos = strpos($this->lastLine, $eol);
115115
if ($pos !== false) {
116-
$line = substr($this->lastLine, 0, $pos);
116+
$line = substr($this->lastLine, 0, $pos + $eolLen);
117117
$this->lastLine = substr($this->lastLine, $pos + $eolLen);
118118
return $line;
119119
}

‎test/StreamWrapperTest.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public function testReadLine()
2222
);
2323
$wrapper = new StreamWrapper($stream);
2424

25-
$this->assertEquals('Reading the contents.', $wrapper->readLine());
26-
$this->assertEquals('From the file', $wrapper->readLine());
27-
$this->assertEquals('Until end.', $wrapper->readLine());
25+
$this->assertEquals("Reading the contents.\n", $wrapper->readLine());
26+
$this->assertEquals("From the file\n", $wrapper->readLine());
27+
$this->assertEquals("Until end.", $wrapper->readLine());
2828
$this->assertEquals('', $wrapper->readLine());
2929

3030
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /