Make WordPress Core

Changeset 3797


Ignore:
Timestamp:
05/26/2006 09:09:06 PM (20 years ago)
Author:
ryan
Message:

base64 cached objects and store within multi-line comment block to avoid CRLF injections into the cache. Props Peter Westwood.

Location:
branches/2.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/wp-admin/upgrade.php

    r3738 r3797  
    7777    case 1:
    7878    $wp_current_db_version = __get_option('db_version');
    79     if ( $wp_db_version < $wp_current_db_version ) {
     79    if ( $wp_db_version != $wp_current_db_version ) {
    8080        wp_cache_flush();
    8181        make_db_current_silent();
  • branches/2.0/wp-includes/cache.php

    r3743 r3797  
    4848}
    4949
    50 define('CACHE_SERIAL_HEADER', "<?php\n//");
    51 define('CACHE_SERIAL_FOOTER', "\n?".">");
     50define('CACHE_SERIAL_HEADER', "<?php\n/*");
     51define('CACHE_SERIAL_FOOTER', "*/\n?".">");
    5252
    5353class WP_Object_Cache {
     
    104104        if ( ! $this->acquire_lock() )
    105105            return false;
    106        
     106
    107107        $this->rm_cache_dir();
    108108        $this->cache = array ();
     
    159159        }
    160160
    161         $this->cache[$group][$id] = unserialize(substr(@ file_get_contents($cache_file), strlen(CACHE_SERIAL_HEADER), -strlen(CACHE_SERIAL_FOOTER)));
     161        $this->cache[$group][$id] = unserialize(base64_decode(substr(@ file_get_contents($cache_file), strlen(CACHE_SERIAL_HEADER), -strlen(CACHE_SERIAL_FOOTER))));
    162162        if (false === $this->cache[$group][$id])
    163163            $this->cache[$group][$id] = '';
     
    343343
    344344                $temp_file = tempnam($group_dir, 'tmp');
    345                 $serial = CACHE_SERIAL_HEADER.serialize($this->cache[$group][$id]).CACHE_SERIAL_FOOTER;
     345                $serial = CACHE_SERIAL_HEADER.base64_encode(serialize($this->cache[$group][$id])).CACHE_SERIAL_FOOTER;
    346346                $fd = @fopen($temp_file, 'w');
    347347                if ( false === $fd ) {
  • branches/2.0/wp-includes/version.php

    r3796 r3797  
    44
    55$wp_version = '2.0.3-beta';
    6 $wp_db_version = 3437;
     6$wp_db_version = 3796;
    77
    88?>
Note: See TracChangeset for help on using the changeset viewer.