Skip to content

Commit

Permalink
[php] check feof after reading (see #4082)
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Mar 26, 2015
1 parent 5e4b7f9 commit 3135ba4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion std/php/_std/sys/io/FileInput.hx
Expand Up @@ -32,8 +32,8 @@ class FileInput extends haxe.io.Input {
}

public override function readByte() : Int {
if(untyped __call__('feof', __f)) return throw new haxe.io.Eof();
var r = untyped __call__('fread', __f, 1);
if(untyped __call__('feof', __f)) return throw new haxe.io.Eof();
if(untyped __physeq__(r, false)) return throw haxe.io.Error.Custom('An error occurred');
return untyped __call__('ord', r);
}
Expand Down
3 changes: 0 additions & 3 deletions tests/sys/src/io/TestFileInput.hx
Expand Up @@ -129,7 +129,6 @@ class TestFileInput extends haxe.unit.TestCase {
file.close();
}

#if !php
public function testSeekEofLast() {
var file : FileInput = File.read(path);
assertEquals(116, file.readByte());
Expand Down Expand Up @@ -214,7 +213,5 @@ class TestFileInput extends haxe.unit.TestCase {
}
file.close();
}
#end

}

0 comments on commit 3135ba4

Please sign in to comment.