stevseea Wed Mar 19 17:38:23 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/standard/tests/streams stream_get_meta_data_file_variation5.phpt stream_get_meta_data_socket_variation4.phpt stream_get_meta_data_file_variation1.phpt stream_get_meta_data_socket_variation1.phpt stream_get_meta_data_file_basic.phpt stream_get_meta_data_socket_basic.phpt stream_get_meta_data_socket_variation3.phpt stream_get_meta_data_process_basic.phpt stream_get_meta_data_dir_basic.phpt stream_get_meta_data_file_variation2.phpt stream_get_meta_data_socket_variation2.phpt stream_get_meta_data_file_error.phpt stream_get_meta_data_file_variation4.phpt stream_set_timeout_error.phpt Log: Adding streams tests
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt +++ php-src/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt --TEST-- testing stream_get_meta_data() "eof" field for a file stream --FILE-- <?php
$filename = __FILE__ . '.tmp'; $fp = fopen($filename, "w+"); echo "Write some data to the file:\n"; $i = 0; while ($i++ < 20) { fwrite($fp, "a line of data\n"); } var_dump(stream_get_meta_data($fp)); //seek to start of file rewind($fp); echo "\n\nRead entire file:\n"; while(!feof($fp)) { fread($fp, 1); } var_dump(stream_get_meta_data($fp)); fclose($fp); unlink($filename); ?> --EXPECTF-- Write some data to the file: array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "w+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Read entire file: array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "w+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(true) } --UEXPECTF-- Write some data to the file: Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "w+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Read entire file: array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "w+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(true) } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt +++ php-src/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt --TEST-- Testing stream_get_meta_data() "eof" field on a udp socket --FILE-- <?php /* Setup socket server */ $server = stream_socket_server('tcp://127.0.0.1:31337'); /* Connect to it */ $client = fsockopen('tcp://127.0.0.1:31337'); /* Accept that connection */ $socket = stream_socket_accept($server); echo "Write some data:\n"; fwrite($socket, "abcdefg\n1234567\nxyzxyz\n"); var_dump(stream_get_meta_data($client)); echo "\n\nRead a line from the client:\n"; fgets($client); var_dump(stream_get_meta_data($client)); echo "\n\nClose the server side socket and read the remaining data from the client:\n"; fclose($socket); fclose($server); while(!feof($client)) { fread($client, 1); } var_dump(stream_get_meta_data($client)); fclose($client); ?> --EXPECTF-- Write some data: array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(%i) ["unread_chars"]=> int(%i) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Read a line from the client: array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(%i) ["unread_chars"]=> int(%i) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Close the server side socket and read the remaining data from the client: array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(%i) ["unread_chars"]=> int(%i) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(true) } --UEXPECTF-- Write some data: Notice: fwrite(): 23 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(%i) [u"unread_chars"]=> int(%i) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Read a line from the client: array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(%i) [u"unread_chars"]=> int(%i) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Close the server side socket and read the remaining data from the client: array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(%i) [u"unread_chars"]=> int(%i) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(true) } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt +++ php-src/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt --TEST-- stream_get_meta_data() with differing file access modes --FILE-- <?php // array of all file access modes $filemodes = array('r', 'r+', 'w', 'w+', 'a', 'a+', 'x', 'x+', 'rb', 'rb+', 'wb', 'wb+', 'ab', 'ab+', 'xb', 'xb+', 'rt', 'rt+', 'wt', 'wt+', 'at', 'at+', 'xt', 'xt+'); //create a file $filename = __FILE__ . '.tmp'; $fp = fopen($filename, 'w+'); fclose($fp); // open file in each access mode and get meta data foreach ($filemodes as $mode) { if (strncmp($mode, 'x', 1) == 0) { // x modes require that file does not exist unlink($filename); } $fp = fopen($filename, $mode); var_dump(stream_get_meta_data($fp)); fclose($fp); } unlink($filename); ?> --EXPECTF-- array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(1) "r" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(1) "w" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "w+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(1) "a" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "a+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(1) "x" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "x+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "rb" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(3) "rb+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "wb" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(3) "wb+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "ab" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(3) "ab+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "xb" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(3) "xb+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "rt" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(3) "rt+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "wt" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(3) "wt+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "at" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(3) "at+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "xt" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(3) "xt+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } --UEXPECTF-- array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(1) "r" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(1) "w" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "w+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(1) "a" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "a+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(1) "x" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "x+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "rb" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(3) "rb+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "wb" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(3) "wb+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "ab" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(3) "ab+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "xb" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(3) "xb+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(11) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "rt" [u"read_filters"]=> array(1) { [0]=> unicode(18) "unicode.from.UTF-8" } [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(12) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(3) "rt+" [u"read_filters"]=> array(1) { [0]=> unicode(18) "unicode.from.UTF-8" } [u"write_filters"]=> array(1) { [0]=> unicode(16) "unicode.to.UTF-8" } [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(11) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "wt" [u"write_filters"]=> array(1) { [0]=> unicode(16) "unicode.to.UTF-8" } [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(12) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(3) "wt+" [u"read_filters"]=> array(1) { [0]=> unicode(18) "unicode.from.UTF-8" } [u"write_filters"]=> array(1) { [0]=> unicode(16) "unicode.to.UTF-8" } [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(11) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "at" [u"write_filters"]=> array(1) { [0]=> unicode(16) "unicode.to.UTF-8" } [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(12) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(3) "at+" [u"read_filters"]=> array(1) { [0]=> unicode(18) "unicode.from.UTF-8" } [u"write_filters"]=> array(1) { [0]=> unicode(16) "unicode.to.UTF-8" } [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "xt" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(12) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(3) "xt+" [u"read_filters"]=> array(1) { [0]=> unicode(18) "unicode.from.UTF-8" } [u"write_filters"]=> array(1) { [0]=> unicode(16) "unicode.to.UTF-8" } [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt +++ php-src/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt --TEST-- Testing stream_get_meta_data() "unread_bytes" field on a udp socket --FILE-- <?php /* Setup socket server */ $server = stream_socket_server('tcp://127.0.0.1:31337'); /* Connect to it */ $client = fsockopen('tcp://127.0.0.1:31337'); /* Accept that connection */ $socket = stream_socket_accept($server); echo "Write some data:\n"; fwrite($socket, "abcdefg\n1234567\nxyzxyz\n"); var_dump(stream_get_meta_data($client)); echo "\n\nRead a line from the client, causing data to be buffered:\n"; fgets($client); var_dump(stream_get_meta_data($client)); echo "\n\nRead 3 bytes of data from the client:\n"; fread($client, 3); var_dump(stream_get_meta_data($client)); echo "\n\nClose the server side socket and read the remaining data from the client:\n"; fclose($socket); fclose($server); while(!feof($client)) { fread($client, 1); } var_dump(stream_get_meta_data($client)); ?> --EXPECT-- Write some data: array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Read a line from the client, causing data to be buffered: array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(15) ["unread_chars"]=> int(15) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Read 3 bytes of data from the client: array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(12) ["unread_chars"]=> int(12) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Close the server side socket and read the remaining data from the client: array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(true) } --UEXPECTF-- Write some data: Notice: fwrite(): 23 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Read a line from the client, causing data to be buffered: array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(15) [u"unread_chars"]=> int(15) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Read 3 bytes of data from the client: array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(12) [u"unread_chars"]=> int(12) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Close the server side socket and read the remaining data from the client: array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(true) } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_get_meta_data_file_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_get_meta_data_file_basic.phpt +++ php-src/ext/standard/tests/streams/stream_get_meta_data_file_basic.phpt --TEST-- stream_get_meta_data() basic functionality --FILE-- <?php $fp = fopen(__FILE__, "r"); var_dump(stream_get_meta_data($fp)); fclose($fp); ?> --EXPECTF-- array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(1) "r" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%sstream_get_meta_data_file_basic.php" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } --UEXPECTF-- array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(1) "r" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%sstream_get_meta_data_file_basic.php" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt +++ php-src/ext/standard/tests/streams/stream_get_meta_data_socket_basic.phpt --TEST-- stream_get_meta_data() on a udp socket --FILE-- <?php $tcp_socket = stream_socket_server('tcp://127.0.0.1:31337'); var_dump(stream_get_meta_data($tcp_socket)); fclose($tcp_socket); ?> --EXPECT-- array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } --UEXPECT-- array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt +++ php-src/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt --TEST-- Testing stream_get_meta_data() "blocked" field on a udp socket --FILE-- <?php /* Setup socket server */ $server = stream_socket_server('tcp://127.0.0.1:31337'); /* Connect to it */ $client = fsockopen('tcp://127.0.0.1:31337'); /* Accept that connection */ $socket = stream_socket_accept($server); var_dump(stream_get_meta_data($client)); echo "\n\nSet blocking to false:\n"; var_dump(socket_set_blocking($client, 0)); var_dump(stream_get_meta_data($client)); echo "\n\nSet blocking to true:\n"; var_dump(socket_set_blocking($client, 1)); var_dump(stream_get_meta_data($client)); fclose($client); fclose($socket); fclose($server); ?> --EXPECT-- array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Set blocking to false: bool(true) array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(false) ["eof"]=> bool(false) } Set blocking to true: bool(true) array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } --UEXPECT-- array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Set blocking to false: bool(true) array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(false) [u"eof"]=> bool(false) } Set blocking to true: bool(true) array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_get_meta_data_process_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_get_meta_data_process_basic.phpt +++ php-src/ext/standard/tests/streams/stream_get_meta_data_process_basic.phpt --TEST-- Testing stream_get_meta_data() on a process stream. --FILE-- <?php $output_file = __FILE__.'.tmp'; $cmd = "echo here is some output"; $mode = 'rb'; $handle = popen($cmd, $mode); $data = fread($handle, 100); var_dump(stream_get_meta_data($handle)); pclose($handle); echo "Done"; ?> --EXPECT-- array(8) { ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "rb" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Done --UEXPECT-- array(8) { [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "rb" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_get_meta_data_dir_basic.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_get_meta_data_dir_basic.phpt +++ php-src/ext/standard/tests/streams/stream_get_meta_data_dir_basic.phpt --TEST-- stream_get_meta_data() on directories --FILE-- <?php $dir = opendir(dirname(__FILE__)); var_dump(stream_get_meta_data($dir)); closedir($dir); $dirObject = dir(dirname(__FILE__)); var_dump(stream_get_meta_data($dirObject->handle)); ?> --EXPECT-- array(9) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(3) "dir" ["mode"]=> string(1) "r" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } array(9) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(3) "dir" ["mode"]=> string(1) "r" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } --UEXPECT-- array(9) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(3) "dir" [u"mode"]=> unicode(1) "r" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } array(9) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(3) "dir" [u"mode"]=> unicode(1) "r" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt +++ php-src/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt --TEST-- Testing stream_get_meta_data() "unread_bytes" field --FILE-- <?php $filename = __FILE__ . '.tmp'; $fp = fopen($filename, "w+"); echo "Write some data to the file:\n"; $i = 0; while ($i++ < 20) { fwrite($fp, "a line of data\n"); } var_dump(stream_get_meta_data($fp)); //seek to start of file rewind($fp); echo "\n\nRead a line of the file, causing data to be buffered:\n"; var_dump(fgets($fp)); var_dump(stream_get_meta_data($fp)); echo "\n\nRead 20 bytes from the file:\n"; fread($fp, 20); var_dump(stream_get_meta_data($fp)); echo "\n\nRead entire file:\n"; while(!feof($fp)) { fread($fp, 1); } var_dump(stream_get_meta_data($fp)); fclose($fp); unlink($filename); ?> --EXPECTF-- Write some data to the file: array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "w+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Read a line of the file, causing data to be buffered: string(15) "a line of data " array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "w+" ["unread_bytes"]=> int(285) ["unread_chars"]=> int(285) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Read 20 bytes from the file: array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "w+" ["unread_bytes"]=> int(265) ["unread_chars"]=> int(265) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Read entire file: array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "w+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "%s.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(true) } --UEXPECTF-- Write some data to the file: Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d Notice: fwrite(): 15 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "w+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Read a line of the file, causing data to be buffered: string(15) "a line of data " array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "w+" [u"unread_bytes"]=> int(285) [u"unread_chars"]=> int(285) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Read 20 bytes from the file: array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "w+" [u"unread_bytes"]=> int(265) [u"unread_chars"]=> int(265) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Read entire file: array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "w+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "%s.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(true) } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt +++ php-src/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt --TEST-- Testing stream_get_meta_data() "timed_out" field on a udp socket --FILE-- <?php /* Setup socket server */ $server = stream_socket_server('tcp://127.0.0.1:31337'); /* Connect to it */ $client = fsockopen('tcp://127.0.0.1:31337'); /* Accept that connection */ $socket = stream_socket_accept($server); var_dump(stream_get_meta_data($client)); echo "\n\nSet a timeout on the client and attempt a read:\n"; socket_set_timeout($client, 0, 1000); fread($client, 1); var_dump(stream_get_meta_data($client)); echo "\n\nWrite some data from the server:\n"; fwrite($socket, "12345"); var_dump(stream_get_meta_data($client)); echo "\n\nRead some data from the client:\n"; fread($client, 5); var_dump(stream_get_meta_data($client)); fclose($client); fclose($socket); fclose($server); ?> --EXPECT-- array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Set a timeout on the client and attempt a read: array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(false) ["timed_out"]=> bool(true) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Write some data from the server: array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(false) ["timed_out"]=> bool(true) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Read some data from the client: array(8) { ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(false) ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } --UEXPECTF-- array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Set a timeout on the client and attempt a read: array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(true) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Write some data from the server: Notice: fwrite(): 5 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(true) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Read some data from the client: array(8) { [u"stream_type"]=> unicode(10) "tcp_socket" [u"mode"]=> unicode(2) "r+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(false) [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt +++ php-src/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt --TEST-- Test stream_get_meta_data() function : error conditions --FILE-- <?php /* Prototype : proto array stream_get_meta_data(resource fp) * Description: Retrieves header/meta data from streams/file pointers * Source code: ext/standard/streamsfuncs.c * Alias to functions: socket_get_status */ echo "*** Testing stream_get_meta_data() : error conditions ***\n"; // Zero arguments echo "\n-- Testing stream_get_meta_data() function with Zero arguments --\n"; var_dump( stream_get_meta_data() ); //Test stream_get_meta_data with one more than the expected number of arguments echo "\n-- Testing stream_get_meta_data() function with more than expected no. of arguments --\n"; $fp = null; $extra_arg = 10; var_dump( stream_get_meta_data($fp, $extra_arg) ); echo "\n-- Testing stream_get_meta_data() function with invalid stream resource --\n"; $fp = null; var_dump(stream_get_meta_data($fp)); echo "\n-- Testing stream_get_meta_data() function with closed stream resource --\n"; $fp = fopen(__FILE__, 'r'); fclose($fp); var_dump(stream_get_meta_data($fp)); echo "Done"; ?> --EXPECTF-- *** Testing stream_get_meta_data() : error conditions *** -- Testing stream_get_meta_data() function with Zero arguments -- Warning: Wrong parameter count for stream_get_meta_data() in %s on line %i NULL -- Testing stream_get_meta_data() function with more than expected no. of arguments -- Warning: Wrong parameter count for stream_get_meta_data() in %s on line %i NULL -- Testing stream_get_meta_data() function with invalid stream resource -- Warning: stream_get_meta_data(): supplied argument is not a valid stream resource in %s on line %i bool(false) -- Testing stream_get_meta_data() function with closed stream resource -- Warning: stream_get_meta_data(): %i is not a valid stream resource in %s on line %i bool(false) Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_get_meta_data_file_variation4.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_get_meta_data_file_variation4.phpt +++ php-src/ext/standard/tests/streams/stream_get_meta_data_file_variation4.phpt --TEST-- stream_get_meta_data() with a relative file path --FILE-- <?php echo "Create a file:\n"; $filename = __FILE__ . '.tmp'; $fp = fopen('File://' . $filename, 'w+'); var_dump(stream_get_meta_data($fp)); fclose($fp); echo "\nChange to file's directory and open with a relative path:\n"; $dirname = dirname($filename); chdir($dirname); $relative_filename = basename($filename); $fp = fopen($relative_filename, 'r'); var_dump(stream_get_meta_data($fp)); fclose($fp); unlink($filename); ?> --EXPECTF-- Create a file: array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(2) "w+" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "File://%sstream_get_meta_data_file_variation4.php.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } Change to file's directory and open with a relative path: array(10) { ["wrapper_type"]=> string(9) "plainfile" ["stream_type"]=> string(5) "STDIO" ["mode"]=> string(1) "r" ["unread_bytes"]=> int(0) ["unread_chars"]=> int(0) ["seekable"]=> bool(true) ["uri"]=> string(%i) "stream_get_meta_data_file_variation4.php.tmp" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } --UEXPECTF-- Create a file: array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(2) "w+" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "File://%sstream_get_meta_data_file_variation4.php.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } Change to file's directory and open with a relative path: array(10) { [u"wrapper_type"]=> unicode(9) "plainfile" [u"stream_type"]=> unicode(5) "STDIO" [u"mode"]=> unicode(1) "r" [u"unread_bytes"]=> int(0) [u"unread_chars"]=> int(0) [u"seekable"]=> bool(true) [u"uri"]=> unicode(%i) "stream_get_meta_data_file_variation4.php.tmp" [u"timed_out"]=> bool(false) [u"blocked"]=> bool(true) [u"eof"]=> bool(false) } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_set_timeout_error.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/streams/stream_set_timeout_error.phpt +++ php-src/ext/standard/tests/streams/stream_set_timeout_error.phpt --TEST-- Test stream_set_timeout() function : error conditions --FILE-- <?php /* Prototype : proto bool stream_set_timeout(resource stream, int seconds, int microseconds) * Description: Set timeout on stream read to seconds + microseonds * Source code: ext/standard/streamsfuncs.c * Alias to functions: socket_set_timeout */ /* * add a comment here to say what the test is supposed to do */ echo "*** Testing stream_set_timeout() : error conditions ***\n"; //Test stream_set_timeout with one more than the expected number of arguments echo "\n-- Testing stream_set_timeout() function with more than expected no. of arguments --\n"; /* Setup socket server */ $server = stream_socket_server('tcp://127.0.0.1:31337'); /* Connect to it */ $client = fsockopen('tcp://127.0.0.1:31337'); $seconds = 10; $microseconds = 10; $extra_arg = 10; var_dump( stream_set_timeout($client, $seconds, $microseconds, $extra_arg) ); // Testing stream_set_timeout with one less than the expected number of arguments echo "\n-- Testing stream_set_timeout() function with less than expected no. of arguments --\n"; $seconds = 10; var_dump( stream_set_timeout($client) ); echo "\n-- Testing stream_set_timeout() function with a closed socket --\n"; fclose($client); var_dump( stream_set_timeout($client, $seconds) ); echo "\n-- Testing stream_set_timeout() function with an invalid stream --\n"; var_dump( stream_set_timeout($seconds, $seconds) ); echo "\n-- Testing stream_set_timeout() function with a stream that does not support timeouts --\n"; $filestream = fopen(__FILE__, "r"); var_dump( stream_set_timeout($filestream, $seconds) ); fclose($filestream); fclose($server); echo "Done"; ?> --EXPECTF-- *** Testing stream_set_timeout() : error conditions *** -- Testing stream_set_timeout() function with more than expected no. of arguments -- Warning: Wrong parameter count for stream_set_timeout() in %s on line %i NULL -- Testing stream_set_timeout() function with less than expected no. of arguments -- Warning: Wrong parameter count for stream_set_timeout() in %s on line %i NULL -- Testing stream_set_timeout() function with a closed socket -- Warning: stream_set_timeout(): %i is not a valid stream resource in %s on line %i bool(false) -- Testing stream_set_timeout() function with an invalid stream -- Warning: stream_set_timeout(): supplied argument is not a valid stream resource in %s on line %i bool(false) -- Testing stream_set_timeout() function with a stream that does not support timeouts -- bool(false) Done
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php