WordPress.org

Make WordPress Core

Changeset 15636


Ignore:
Timestamp:
09/20/2010 06:11:06 PM (8 years ago)
Author:
ryan
Message:

Speed up is_serialized() with strpbrk(). Props Rasmus. see #14429

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r15634 r15636  
    233233        return false;
    234234    $data = trim( $data );
    235     if ( 'N;' == $data )
     235    if ( 'N;' == $data )
    236236        return true;
    237     if ( !preg_match( '/^([adObis]):/', $data, $badions ) )
     237    if ( function_exists('strpbrk') ) {
     238        if ( strlen($data) > 1 && strpbrk($data,'adObis') == $data && $data[1] == ':' ) {
     239            $badions = array();
     240            $badions[1] = $data[0];
     241        } else {
     242            return false;
     243        }
     244    } elseif ( !preg_match( '/^([adObis]):/', $data, $badions ) ) {
    238245        return false;
     246    }
    239247    switch ( $badions[1] ) {
    240248        case 'a' :
Note: See TracChangeset for help on using the changeset viewer.