Make WordPress Core


Ignore:
Timestamp:
01/30/2024 03:12:40 PM (16 months ago)
Author:
jorbin
Message:

Grouped Backports to the 4.3 branch.

  • Install: When populating options, maybe_serialize instead of always serialize.
  • Uploads: Check for and verify ZIP archives.

Merges [57388] and [57389] to the 4.3 branch.

Props costdev, peterwilsoncc, azaozz, tykoted, johnbillion, desrosj, afragen, jorbin, xknown.

Location:
branches/4.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.3

  • branches/4.3/src/wp-admin/includes/class-wp-upgrader.php

    r38528 r57412  
    24312431            if ( isset( $file['error'] ) )
    24322432                wp_die( $file['error'] );
     2433
     2434            if ( 'pluginzip' === $form || 'themezip' === $form ) {
     2435                $archive_is_valid = false;
     2436
     2437                /** This filter is documented in wp-admin/includes/file.php */
     2438                if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) {
     2439                    $archive          = new ZipArchive();
     2440                    $archive_is_valid = $archive->open( $file['file'], ZIPARCHIVE::CHECKCONS );
     2441
     2442                    if ( true === $archive_is_valid ) {
     2443                        $archive->close();
     2444                    }
     2445                } else {
     2446                    require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
     2447
     2448                    $archive          = new PclZip( $file['file'] );
     2449                    $archive_is_valid = is_array( $archive->properties() );
     2450                }
     2451
     2452                if ( true !== $archive_is_valid ) {
     2453                    wp_delete_file( $file['file'] );
     2454                    wp_die( __( 'Incompatible Archive.' ) );
     2455                }
     2456            }
    24332457
    24342458            $this->filename = $_FILES[$form]['name'];
Note: See TracChangeset for help on using the changeset viewer.