Make WordPress Core


Ignore:
Timestamp:
01/30/2024 03:10:15 PM (11 months ago)
Author:
jorbin
Message:

Grouped Backports to the 4.5 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.5 branch.

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

Location:
branches/4.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.5

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

    r38526 r57410  
    26262626            if ( isset( $file['error'] ) )
    26272627                wp_die( $file['error'] );
     2628
     2629            if ( 'pluginzip' === $form || 'themezip' === $form ) {
     2630                $archive_is_valid = false;
     2631
     2632                /** This filter is documented in wp-admin/includes/file.php */
     2633                if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) {
     2634                    $archive          = new ZipArchive();
     2635                    $archive_is_valid = $archive->open( $file['file'], ZIPARCHIVE::CHECKCONS );
     2636
     2637                    if ( true === $archive_is_valid ) {
     2638                        $archive->close();
     2639                    }
     2640                } else {
     2641                    require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
     2642
     2643                    $archive          = new PclZip( $file['file'] );
     2644                    $archive_is_valid = is_array( $archive->properties() );
     2645                }
     2646
     2647                if ( true !== $archive_is_valid ) {
     2648                    wp_delete_file( $file['file'] );
     2649                    wp_die( __( 'Incompatible Archive.' ) );
     2650                }
     2651            }
    26282652
    26292653            $this->filename = $_FILES[$form]['name'];
Note: See TracChangeset for help on using the changeset viewer.