Browse Source

[php] check feof after reading (see #4082)

Simon Krajewski 10 years ago
parent
commit
3135ba45df
2 changed files with 1 additions and 4 deletions
  1. 1 1
      std/php/_std/sys/io/FileInput.hx
  2. 0 3
      tests/sys/src/io/TestFileInput.hx

+ 1 - 1
std/php/_std/sys/io/FileInput.hx

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

+ 0 - 3
tests/sys/src/io/TestFileInput.hx

@@ -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());
@@ -214,7 +213,5 @@ class TestFileInput extends haxe.unit.TestCase {
 		}
 		file.close();
 	}
-	#end
-
 }