It seems that zip_entry_read returns an empty string (i.e. '') at the end of file instead of FALSE. At least in PHP 5.3 on Windows XP.
zip_entry_read
(PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
zip_entry_read — オープンされたディレクトリエントリから読み込む
説明
string zip_entry_read
( resource
$zip_entry
[, int $length
] )オープンされたディレクトリエントリから読み込みます。
パラメータ
-
zip_entry -
zip_read()により返されたディレクトリエントリ
-
length -
返すバイト数。指定されない場合、この関数は1024バイトを読み込みます。
注意:
これは、読み込むデータの非圧縮時の長さとなります。
返り値
読み込んだデータ、または、ファイルの終端に達した時に
FALSE を返します。
reached.
参考
- zip_entry_open() - 読込み用にディレクトリエントリをオープンする
- zip_entry_close() - ディレクトリエントリを閉じる
- zip_entry_filesize() - ディレクトリエントリの実際のファイルサイズを取得する
Twan
02-May-2010 03:48
Matt
17-Nov-2005 01:53
When reading from a zip file if the initial call to zip_entry_read() returns false it would be advisable to run mkdir with the file name since it it very likely that the zero length file was a directory and attempts to save the files within the directory will fail if you dont create it first
