Re: new bug in 5.1.0b3 with length param in fread() with local files

From: Date: Fri, 22 Jul 2005 15:57:37 +0000
Subject: Re: new bug in 5.1.0b3 with length param in fread() with local files
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-17385@lists.php.net to get a copy of this message
Wez Furlong wrote:
If you've spotted a behaviour change, open a new bug with a short self-contained reproducing script. I suspect some kind of engine bug here, because what you've described doesn't make sense :) That warning about the length comes from this code in the fread function:
    len = Z_LVAL_PP(arg2);
    if (len <= 0) {
        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter
must be greater than 0");
        RETURN_FALSE;
    }
So either you are passing in something that evaluates as 0 (or less), or something is corrupting memory and breaking the length value by the time it reaches fread().
In the attempt to find a short reproducing test script, I determined that the warning was caused by an earlier iteration through the method that uses fread. So, the warning was valid (0 was being passed in). What this means, however, is that the script is in fact simply failing to read in the requested amount with no warning at all. I'll have a test script shortly for the bug report. Greg

« previous php.internals (#17385) next »