1--TEST-- 2Check for fs read and close 3--FILE-- 4<?php 5define("FIXTURE_PATH", dirname(__FILE__) . "/fixtures/hello.data"); 6 7uv_fs_open(uv_default_loop(), FIXTURE_PATH, UV::O_RDONLY, 0, function($r) { 8 uv_fs_read(uv_default_loop(), $r, $offset = 0, $len = 32, function($stream, $data) { 9 if (is_long($data)) { 10 if ($data < 0) { 11 throw new Exception("read error"); 12 } 13 14 uv_fs_close(uv_default_loop(), $stream, function() { }); 15 } else { 16 echo trim($data) . "\n"; 17 } 18 }); 19}); 20 21// test offset 22uv_fs_open(uv_default_loop(), FIXTURE_PATH, UV::O_RDONLY, 0, function($r) { 23 uv_fs_read(uv_default_loop(), $r, $offset = 1, $len = 32, function($stream, $data) { 24 if (is_long($data)) { 25 if ($data < 0) { 26 throw new Exception("read error"); 27 } 28 29 uv_fs_close(uv_default_loop(), $stream, function() { }); 30 } else { 31 echo "H" . trim($data) . "\n"; 32 } 33 }); 34}); 35 36 37uv_run(); 38?> 39--EXPECT-- 40Hello 41Hello 42