PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » PHP » PHP_Compat » Bug #5691

fputcsv uses wrong variable in is_resource()

Details

Submitted2005-10-14 12:11 UTC
Fromleening at dauphin-mm dot nl
Assignedaidan
StatusClosed
PackagePHP_Compat
PHP Version4.3.10
OSlinux
Roadmaps(Not assigned)

Comments

[2005-10-14 12:11 UTC] leening at dauphin-mm dot nl

Description:
------------
fputcsv uses wrong variable in is_resource()

it uses $extension but this variable is not available. It should use $handle

use the patch below to fix this

Version: PHP_Compat 1.4.1

Test script:
---------------
--- fputcsv.php.old 2005-10-14 14:08:10.714181683 +0200
+++ fputcsv.php.new 2005-10-14 14:08:01.826871275 +0200
@@ -34,9 +34,9 @@
function fputcsv($handle, $fields, $delimiter = ',', $enclosure = '"')
{
// Sanity Check
- if (!is_resource($extension)) {
+ if (!is_resource($handle)) {
user_error('fputcsv() expects parameter 1 to be resource, ' .
- gettype($extension) . ' given', E_USER_WARNING);
+ gettype($handle) . ' given', E_USER_WARNING);
return false;
}

Expected result:
----------------
n/a

Actual result:
--------------
n/a