Make WordPress Core

Ticket #37757: ticket-37757.patch

File ticket-37757.patch, 1.2 KB (added by seuser, 8 years ago)

Updated patch with tests and minor bugfix

  • src/wp-includes/functions.php

    diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
    index 03c6126..843d988 100644
    a b function get_weekstartend( $mysqlstring, $start_of_week = '' ) { 
    321321 * Unserialize value only if it was serialized.
    322322 *
    323323 * @since 2.0.0
     324 * @since 4.9.0 Added the `$options` parameter.
    324325 *
    325326 * @param string $original Maybe unserialized original, if is needed.
     327 * @param array  $options  Optional. Array of options to pass to unserialize if the PHP version is greater than 7.0.
    326328 * @return mixed Unserialized data can be any type.
    327329 */
    328 function maybe_unserialize( $original ) {
    329         if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
    330                 return @unserialize( $original );
    331         return $original;
     330function maybe_unserialize( $original, $options = array() ) {
     331        // don't attempt to unserialize data that wasn't serialized going in.
     332        if ( ! is_serialized( $original ) ) {
     333                return $original;
     334        }
     335
     336        if ( defined( 'PHP_MAJOR_VERSION' ) && PHP_MAJOR_VERSION >= 7 ) {
     337                return @unserialize( $original, $options );
     338        }
     339        return @unserialize( $original );
    332340}
    333341
    334342/**