File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file / bug37158.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:03 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Bug #37158 (if userspace stream is present, fread() reads in 8192 max, otherwise it works)
--FILE--
<?php

class VariableStream {
   
   function stream_open($path, $mode, $options, &$opened_path) 
   {
       return true;
   }
}

stream_wrapper_register("var", "VariableStream");

error_reporting(E_ALL | E_STRICT);
$file = dirname(__FILE__) . '/footest.txt';
$x = str_repeat(1, 8192);
$fp = fopen($file, 'w');
for ($i = 0; $i < 5; $i++) {
	fwrite($fp, $x);
}
fclose($fp);

$fp = fopen($file, 'r');
$outsidecontents = fread($fp, 20000);
fclose($fp);
var_dump('size of contents 1 = ' . strlen($outsidecontents));
$outsidecontents = file_get_contents($file);
var_dump('size of contents 2 = ' . strlen($outsidecontents));

unlink($file);

echo "Done\n";
?>
--EXPECT--	
string(26) "size of contents 1 = 20000"
string(26) "size of contents 2 = 40960"
Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>