Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#14882 closed defect (bug) (fixed)

streams.php, POMO_FileReader, binary read fopen, Windows

Reported by: cr00nad Owned by: nbachiyski
Milestone: 3.3 Priority: low
Severity: normal Version: 3.0.1
Component: General Keywords: has-patch commit windows 3.3-early
Focuses: Cc:


My system is :

PHP 4.3.0
Mysql 4.1

Minimal requiem for Wordpress.

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


function POMO_FileReader($filename) {

$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.


function POMO_FileReader($filename) {

$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

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;


Attachments (1)

14882.patch (447 bytes) - added by hakre 5 years ago.

Download all attachments as: .zip

Change History (9)

#1 @hakre
5 years ago

  • Keywords has-patch added

Feedback seems reasonable to me. Maybe this is already fixed upstream in Pear?

5 years ago

#2 @nbachiyski
5 years ago

The change seems harmless, passes all tests, and was committed in http://trac.glotpress.org/changeset/597

#4 @nbachiyski
5 years ago

  • Keywords commit windows added
  • Milestone changed from Awaiting Review to 3.1
  • Owner set to nbachiyski
  • Priority changed from normal to low
  • Status changed from new to assigned

#5 @scribu
5 years ago

  • Keywords 3.2-early added
  • Milestone changed from 3.1 to Future Release

This is not a critical bug and it's not a regression from WP 3.0, so it can wait.

#6 @SergeyBiryukov
4 years ago

  • Keywords 3.3-early added; 3.2-early removed

#7 @SergeyBiryukov
4 years ago

  • Milestone changed from Future Release to 3.3

#8 @ryan
4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in [18528]

Note: See TracTickets for help on using tickets.