Make _unzip_file_ziparchive() PHP4 safe. See #10403.

git-svn-id: http://svn.automattic.com/wordpress/trunk@13015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2010-02-07 21:28:05 +00:00
parent f65140c7b3
commit 5128c1ccc2
1 changed files with 4 additions and 2 deletions

View File

@ -547,11 +547,13 @@ function unzip_file($file, $to) {
* @param array $needed_dirs A partial list of required folders needed to be created. * @param array $needed_dirs A partial list of required folders needed to be created.
* @return mixed WP_Error on failure, True on success * @return mixed WP_Error on failure, True on success
*/ */
function _unzip_file_ziparchive($file, $to, $needed_dirs = array()) { function _unzip_file_ziparchive($file, $to, $needed_dirs = array() ) {
global $wp_filesystem; global $wp_filesystem;
$z = new ZipArchive(); $z = new ZipArchive();
if ( true !== $z->open($file, ZIPARCHIVE::CHECKCONS) )
// PHP4-compat - php4 classes can't contain constants
if ( true !== $z->open($file, /* ZIPARCHIVE::CHECKCONS */ 4) )
return new WP_Error('incompatible_archive', __('Incompatible Archive.')); return new WP_Error('incompatible_archive', __('Incompatible Archive.'));
for ( $i = 0; $i < $z->numFiles; $i++ ) { for ( $i = 0; $i < $z->numFiles; $i++ ) {