note 77129 added to function.zip-entry-read

From: Date: Thu, 16 Aug 2007 12:03:44 +0000
Subject: note 77129 added to function.zip-entry-read
Groups: php.notes 
Request: Send a blank email to php-notes+get-129527@lists.php.net to get a copy of this message
Ive got a big Problem with the "zip_entry_read" function, and I dont unterstand what I did wrong. I tried to write a function, wicht reads all zip Entries of a file into an Array. It worked, I can read alle Methadata from this array. But when i try to read the content, I always get nothing. This is an example whre you can see whats the problem: when I read 10 Bytes content IN the funktion, it works, but when I try the same with the returnvalue (or with the refference of the entries), it won`t work. With the result of the function, I can also read all the methadata (filename, size ...) but only the Content, seems to be emty after the function. <?php require("zip_funct.inc.php"); function test(&$zip_entry = null) { $zip = zip_open("test.zip"); while( $tmp[] = zip_read($zip) ); array_pop($tmp); $zip_entry = $tmp; $n = 2; var_dump($zip_entry); $buf = zip_entry_read($zip_entry[$n], 10); echo "CONTENT:\n------------------\n".$buf."\n"; echo "------------------\n"; echo "Name: " . zip_entry_name($zip_entry[$n]) . "\n"; echo "Actual Filesize: " . zip_entry_filesize($zip_entry[$n]) . "\n"; echo "Compressed Size: " . zip_entry_compressedsize($zip_entry[$n]) . "\n"; echo "Compression Method: " . zip_entry_compressionmethod($zip_entry[$n]) . "\n"; // echo fread($result, 50); return $zip_entry; } // ################################################## // test($zip_entry); // try to get the zip_entries via Refference $zip_entry = test(); // try to get zip_entries s return value $n = 2; var_dump($zip_entry); $buf = zip_entry_read($zip_entry[$n], 10); echo "CONTENT:\n------------------\n".$buf."\n"; echo "------------------\n"; echo "Name: " . zip_entry_name($zip_entry[$n]) . "\n"; echo "Actual Filesize: " . zip_entry_filesize($zip_entry[$n]) . "\n"; echo "Compressed Size: " . zip_entry_compressedsize($zip_entry[$n]) . "\n"; echo "Compression Method: " . zip_entry_compressionmethod($zip_entry[$n]) . "\n"; ?> The screenoutput looks like this: array(8) { [0]=> resource(61) of type (Zip Entry) [1]=> resource(62) of type (Zip Entry) // and a lot other entries } CONTENT: ------------------ <html> <h ------------------ Name: tmp.html Actual Filesize: 1136 Compressed Size: 360 Compression Method: deflated array(8) { [0]=> resource(61) of type (Zip Entry) [1]=> resource(62) of type (Zip Entry) // and a lot other entries } CONTENT: ------------------ ------------------ Name: tmp.html Actual Filesize: 1136 Compressed Size: 360 Compression Method: deflated And this output shows, that the returnvalue of the function still as a valid ressource and still returns the correct methadata, but the content is empty. I try to solve this problem since weeks and I realy need help. If anybody has an idea whats the Problem, please notice hear. ---- Server IP: 69.147.83.197 Probable Submitter: 84.179.62.225 ---- Manual Page -- http://www.php.net/manual/en/function.zip-entry-read.php Edit -- https://master.php.net/note/edit/77129 Del: integrated -- https://master.php.net/note/delete/77129/integrated Del: useless -- https://master.php.net/note/delete/77129/useless Del: bad code -- https://master.php.net/note/delete/77129/bad+code Del: spam -- https://master.php.net/note/delete/77129/spam Del: non-english -- https://master.php.net/note/delete/77129/non-english Del: in docs -- https://master.php.net/note/delete/77129/in+docs Del: other reasons-- https://master.php.net/note/delete/77129 Reject -- https://master.php.net/note/reject/77129 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129527) next »