Edit report at http://bugs.php.net/bug.php?id=54485&edit=1
ID: 54485 Updated by: paj...@php.net Reported by: arno at renevier dot net Summary: extractTo reports success even in case of write error -Status: Open +Status: Feedback Type: Bug Package: Zip Related Operating System: linux PHP Version: 5.3SVN-2011-04-07 (snap) -Assigned To: +Assigned To: pajoye Block user comment: N Private report: N New Comment: Please provide a standalone reproduce case. Is the error due to the zip archive or the destination directory (not writable, etc.)? Previous Comments: ------------------------------------------------------------------------ [2011-04-07 15:02:38] arno at renevier dot net Description: ------------ Hi, I've encountered the bug when trying to unzip a file into a full disk. ZipArchive::extractTo reported true, but the extracted file had a 0 size. It would be nice if extractTo had reported false, so I could have known something was wrong. I've experienced the bug with debian php 5.3.6-7 and with php build from php5.3-201104071030.tar.bz2 with ./configure --enable-zip && make May be php_zip_extract_file could return 0 if php_stream_write returns 0 in the n=zip_fread loop PS: this bug may be the same as #53893 but as I'm unsure, I prefer to open a new one. Test script: --------------- function unzip ($file) { $za = new \ZipArchive(); if ($za->open($file) === FALSE) { throw new Exception ("invalid zip file " . $file); } if ($za->numFiles != 1) { throw new Exception ("invalid zip file " . $file); } if (($archive = $za->getNameIndex(0)) === FALSE) { throw new Exception ("invalid zip file " . $file); } if ($za->extractTo('target', $archive) === FALSE) { throw new Exception ("could not extract archive " . $archive); } if ($za->close() === FALSE) { throw new Exception ("could not extract archive " . $archive); } } unzip('somefile.zip'); Expected result: ---------------- the script should throw an exception. Actual result: -------------- no exception is thrown. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54485&edit=1