From: rquadling Operating system: Windows XP SP3 PHP version: 5.3.5 Package: Zip Related Bug Type: Bug Bug description:zipArchive::addPattern requires path parameter
Description: ------------ php --rf zipArchive::addPattern tells us that the path is optional. This is confirmed by the parameter parsing. But, at least on windows, if no path is supplied, with a pattern that will include everything, no files are added. Setting the path to the current directory (for example) will include all files in that directory (using the same regex). Test script: --------------- <?php $zip = new ZipArchive; if (True === $zip->open('./TestAddPattern.zip', ZIPARCHIVE::CREATE)) { echo 'Add all files with no path param', PHP_EOL, print_r($zip->addPattern('/.*/'), True), PHP_EOL, 'Number of files : ', $zip->numFiles, PHP_EOL, 'Add all files in current path param', PHP_EOL, print_r($zip->addPattern('/.*/', '.'), True), PHP_EOL, 'Number of files : ', $zip->numFiles, PHP_EOL; $zip->close(); } Expected result: ---------------- Add all files with no path param Array ( [0] => .\25.BAT ... [88] => .\upxit.bat ) Number of files : 89 Add all files in current path param Array ( [0] => .\25.BAT ... [88] => .\upxit.bat ) Number of files : 178 Actual result: -------------- Add all files with no path param Number of files : 0 Add all files in current path param Array ( [0] => .\25.BAT ... [88] => .\upxit.bat ) Number of files : 89 -- Edit bug report at http://bugs.php.net/bug.php?id=53856&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53856&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53856&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53856&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53856&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53856&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53856&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53856&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53856&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53856&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53856&r=support Expected behavior: http://bugs.php.net/fix.php?id=53856&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53856&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53856&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53856&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53856&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53856&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53856&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53856&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53856&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53856&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53856&r=mysqlcfg