Home » PHP » PHP_Compat » Bug #5691
fputcsv uses wrong variable in is_resource()
Details
| Submitted | 2005-10-14 12:11 UTC |
|---|---|
| From | leening at dauphin-mm dot nl |
| Assigned | aidan |
| Status | Closed |
| Package | PHP_Compat |
| PHP Version | 4.3.10 |
| OS | linux |
| 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