WordPress.org

Make WordPress Core

Changeset 4315


Ignore:
Timestamp:
10/04/06 07:34:55 (8 years ago)
Author:
markjaquith
Message:

Refrain from reading files of 0 length. Props technosailor. fixes #1999

File:
1 edited

Legend:

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

    r3937 r4315  
    7272    update_recently_edited($file); 
    7373 
    74     if (!is_file($real_file)) 
     74    if ( !is_file($real_file) ) { 
    7575        $error = true; 
    76      
    77     if (!$error) { 
     76    } else { 
    7877        $f = @ fopen($real_file, 'r'); 
    7978        if ( $f ) { 
    80             $content = fread($f, filesize($real_file)); 
    81             $content = htmlspecialchars($content); 
     79            if ( filesize($real_file ) > 0 ) { 
     80                $content = fread($f, filesize($real_file)); 
     81                $content = htmlspecialchars($content); 
     82            } else { 
     83                $content = ''; 
     84            } 
    8285        } else { 
    8386            $error = true; 
Note: See TracChangeset for help on using the changeset viewer.