Make WordPress Core

Opened 6 years ago

Closed 3 years ago

Last modified 3 years ago

#44002 closed defect (bug) (duplicate)

fread(): Length parameter must be greater than 0 - Happens on all updates to core, plugins, themes.

Reported by: mopsyd's profile mopsyd Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.5
Component: Upgrade/Install Keywords: reporter-feedback
Focuses: Cc:


I'm getting this error in my log every time updates are run. It occurs regardless of whether any plugins or non-wordpress issued themes are active. I am using Sentry on my live site to catch pretty much all errors, and this consistently turns up every time anything updates.

As a test measure, I disabled app 3rd-party plugins and themes, and ran an update against an older version of the twentyfifteen theme as an isolated case. The issue still occurs in lieu of any other 3rd party modifications.

array(4) {
  string(48) "fread(): Length parameter must be greater than 0"
  string(66) "/xxx/xxx/xxx/xxx/"

This appears to be a core bug with the updater. The issue has been consistent since at least 4.9.0, probably earlier.

This component needs to be using fstat to check the size prior to attempting to read. Something like this:

$f = fopen('file', 'r+');
$stat = fstat($f);
$size = $stat['size'];

if ( $size > 0 )
    // The file is non-zero length and safe to read.
    $contents = fread( $f );
    // Carry on.
} else {
    // Do not fread an empty file. Return, throw an exception, whatever's clever.

Change History (5)

#1 @subrataemfluence
6 years ago

Is this blocking your upgrades? I did not look into the log yet though.

#2 @pbiron
3 years ago

@mopsyd I believe this problem was fixed in WP 5.7, as part of #52018.

Can you please confirm whether you are still experiencing this (assuming you've updated the site in question to 5.7)?

This ticket was mentioned in Slack in #core-auto-updates by pbiron. View the logs.

3 years ago

#4 @pbiron
3 years ago

  • Keywords reporter-feedback added
  • Resolution set to fixed
  • Status changed from new to closed

@mopsyd marking this as fixed. If you believe the problem still exists in WP 5.7 or later, then feel free to reopen this ticket and we'll look into it more.

#5 @desrosj
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution changed from fixed to duplicate

Duplicate of #52018.

Note: See TracTickets for help on using tickets.