瀏覽代碼

[php] throw Eof on FileInput.readBytes() if amount of bytes read is 0 (fixes #7345)

Alexander Kuzmenko 7 年之前
父節點
當前提交
c1e9da2ca1
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      std/php/_std/sys/io/FileInput.hx

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

@@ -47,6 +47,7 @@ class FileInput extends haxe.io.Input {
 	public override function readBytes( s : Bytes, p : Int, l : Int ) : Int {
 		if(feof(__f)) throw new Eof();
 		var r = fread(__f, l);
+		if(strlen(r) == 0) throw new Eof();
 		if(r == false) throw Custom('An error occurred');
 		var b = Bytes.ofString(r);
 		s.blit(p, b, 0, (r:String).length);