WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 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:

Description

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@…

Attachments (1)

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

Download all attachments as: .zip

Change History (9)

comment:1 @hakre4 years ago

  • Keywords has-patch added

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

@hakre4 years ago

comment:2 @nbachiyski4 years ago

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

comment:4 @nbachiyski4 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

comment:5 @scribu4 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.

comment:6 @SergeyBiryukov4 years ago

  • Keywords 3.3-early added; 3.2-early removed

comment:7 @SergeyBiryukov4 years ago

  • Milestone changed from Future Release to 3.3

comment:8 @ryan3 years ago

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

Fixed in [18528]

Note: See TracTickets for help on using tickets.