PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Logging » Log » Bug #9388

File Log doesn't check file point

Details

Submitted2006-11-19 21:26 UTC
Fromderek at battams dot ca
Assignedjon
StatusClosed
PackageLog
PHP VersionIrrelevant
OSLinux
Roadmaps(Not assigned)

Comments

[2006-11-19 21:26 UTC] derek at battams dot ca

Description:
------------
Log/file.php:

The flush() method assumes that the member file pointer is always valid - this isn't true if the log hasn't been written to, but a flush is attempted.

Test script:
---------------
Suggested patch for the flush method:

function flush()
{
if(is_resource($this->_fp))
$ret = fflush($this->_fp);
else
$ret = true;
return $ret;
}

Expected result:
----------------
No PHP warning.

Actual result:
--------------
Warning: fflush(): supplied argument is not a valid stream resource in /usr/lib/php/Log/file.php on line 253