[wp-trac] [WordPress Trac] #14882: streams.php, POMO_FileReader, binary read fopen, Windows

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 16 08:17:46 UTC 2010


#14882: streams.php, POMO_FileReader, binary read fopen, Windows
--------------------------+-------------------------------------------------
 Reporter:  cr00nad       |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.0.1          
 Severity:  normal        |    Keywords:                 
--------------------------+-------------------------------------------------
 My system is :

 Windows
 PHP 4.3.0
 Mysql 4.1

 Minimal requiem for Wordpress.

 In file: wp-includes/pomo/streams.php
 Class: POMO_FileReader

 Code:

         function POMO_FileReader($filename) {
                 parent::POMO_Reader();
                 $this->_f = fopen($filename, 'r');
         }
 BUG (from PHP.net):
 On systems which differentiate between binary and text files (i.e.
 Windows) the file must be opened with 'b' included in fopen() mode
 parameter.

 FIX:
         function POMO_FileReader($filename) {
                 parent::POMO_Reader();
                 $this->_f = fopen($filename, 'rb');
         }

 If you don't set 'rb' parametr in fopen languages files like mo are not
 loaded into system. Becouse incorrect read length
 CLASS: POMO_Reader
         function strlen($string) {
                 if ($this->is_overloaded) {
                         return mb_strlen($string, 'ascii');
                 } else {
                         return strlen($string);
                 }
         }
 And script stop on this line :
 FILE: mo.php
                 $originals = $reader->read($originals_lengths_length);
                 if ( $reader->strlen( $originals ) !=
 $originals_lengths_length )
                         return false;

 --
 cr00nad at gmail.com

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14882>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list