WordPress.org

Make WordPress Core

Ticket #37757: 37757.diff

File 37757.diff, 1.2 KB (added by NathanAtmoz, 3 years ago)

first pass at a patch

  • src/wp-includes/functions.php

    diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
    index ffb09f2..39dcbd0 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        if ( ! is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
     332                return $original;
     333
     334        if( defined( PHP_MAJOR_VERSION ) && PHP_MAJOR_VERSION >= 7 ) {
     335                return @unserialize( $original, $options );
     336        }
     337        return @unserialize( $original );
    332338}
    333339
    334340/**