From 3135ba45df95ef1e1837ead245744554538fdcd2 Mon Sep 17 00:00:00 2001 From: Simon Krajewski Date: Thu, 26 Mar 2015 10:44:35 +0100 Subject: [PATCH] [php] check feof after reading (see #4082) --- std/php/_std/sys/io/FileInput.hx | 2 +- tests/sys/src/io/TestFileInput.hx | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/std/php/_std/sys/io/FileInput.hx b/std/php/_std/sys/io/FileInput.hx index 48c76aaecb3..e505c7d6dda 100644 --- a/std/php/_std/sys/io/FileInput.hx +++ b/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); } diff --git a/tests/sys/src/io/TestFileInput.hx b/tests/sys/src/io/TestFileInput.hx index 9206601e458..1c8ab7280ed 100644 --- a/tests/sys/src/io/TestFileInput.hx +++ b/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 - }