Opened 3 years ago
Last modified 17 months ago
#14207 assigned defect (bug)
streams.php, POMO_FileReader $length parameter of fread
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | I18N | Version: | 3.0 |
| Severity: | major | Keywords: | has-patch reporter-feedback |
| Cc: |
Description
the fread function run with an error, when you have the length-paramter ist 0. This is possible on use WP in local engines and intranet.
Small changes on the function: read in class POMO_FileReader
function read($bytes) {
if ( isset($bytes) && ( 0 > $bytes ) )
return fread($this->_f, $bytes);
else
return;
}
Attachments (4)
Change History (15)
comment:1
nacin
— 3 years ago
- Component changed from Administration to i18n
- Severity changed from critical to major
comment:2
bueltge
— 3 years ago
the warning is an problem when you work with WP_DEBUG true; its not possible to use the backend. Yes, you can change this to empty().
comment:3
nacin
— 3 years ago
- Milestone changed from Awaiting Review to Future Release
- Owner set to nbachiyski
- Status changed from new to assigned
comment:4
SergeyBiryukov
— 2 years ago
- Keywords reporter-feedback added
What are the steps to reproduce this?
comment:5
Bueltge
— 2 years ago
"the fread function run with an error, when you have the length-paramter ist 0. This is possible on use WP in local engines and intranet"
when the blog in a landscape without internet-connection
SergeyBiryukov
— 2 years ago
comment:6
SergeyBiryukov
— 2 years ago
Still don't quite understand the connection between intranet and reading .mo files.
However I guess the condition in the patch should be inverted:
if ( !empty($bytes) ) return fread($this->_f, $bytes); else return false;
Uploaded new patch.
comment:7
bueltge
— 2 years ago
I have check this on my development-version and now works fine, no errors for fread. Thanks
function read($bytes) {
if ( !empty($bytes) )
return fread($this->_f, $bytes);
else
return false;
}
comment:8
SergeyBiryukov
— 2 years ago
Related: #14882
comment:9
SergeyBiryukov
— 22 months ago
- Keywords reporter-feedback removed
comment:10
nacin
— 17 months ago
Perhaps the read() method should be avoided if ! $bytes?
SergeyBiryukov
— 17 months ago
comment:11
SergeyBiryukov
— 17 months ago
- Keywords reporter-feedback added
read() method is only called for an arbitrary number of bytes in lines 160 and 169 of mo.php:
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/pomo/mo.php#L160
14207.2.patch makes sure the values passed to read() are not zero.
I'm still not sure what are we trying to fix here though. I've checked a localized install without Internet access with WP_DEBUG on and didn't see any warnings.
Without speaking at all to the validity of the patch, checking for empty() would be much simpler.
Lowering priority a bit as fread() with zero length fires only a warning, not a fatal, and I'm still not sure of the steps to reproduce an instance where 0 is requested.