Re: [PHP-DEV] 'file' splits data into 8k chunks From: Zeev Suraski (zeev <email protected>)
Date: 06/26/00

I removed this limit. Upgrade to 4.0.1 when it comes out (or update to the
CVS).

Zeev

At 19:53 26/06/2000, chrism wrote:
>bugs.php.net is down - this is with php 4.0.0
>
>Chris
>chrism <email protected>
>
>twinhead% php -q test.php
>data size: 17000
># of records.. 3
>chunk 1: 8190 bytes.
>chunk 2: 8190 bytes.
>chunk 3: 620 bytes.
>
>-- begin included file --
><?php
>
>/*
> * 'file' command incorrectly splits records into 8k chunks
> */
>
>/* generate 1 line data file of approximate length */
>function create_data($filename, $limit) {
> $record = "";
> do {
> $record .= "TEXT";
> } while (strlen($record) < $limit);
>
> echo "data size: " . strlen($record) . "\n";
>
> $fh = fopen($filename, "w");
> fputs($fh, $record);
> fclose($fh);
>}
>
>/* load data using 'file' command and display result summary */
>function check_file($filename) {
> $farray = file($filename);
> $fsize = count($farray);
> echo "# of records.. " . $fsize . "\n";
> for ($i = 0; $i < $fsize; $i++) {
> echo "chunk " . ($i + 1) . ": " . strlen($farray[$i]) . "
> bytes.\n";
> }
>}
>
>create_data("test.txt", 17000);
>check_file("test.txt");
>
>?>
>--end included file --
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
>For additional commands, e-mail: php-dev-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>

--
Zeev Suraski   <zeev <email protected>>  http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>