Bug #70426 [Fbk->Opn]: fGetCsv() doesn't work with php://temp or php://memory
| From: | pet dot draexler at gmail dot com | Date: | Fri, 04 Sep 2015 09:34:54 +0000 |
| Subject: | Bug #70426 [Fbk->Opn]: fGetCsv() doesn't work with php://temp or php://memory | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-195754@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70426&edit=1
ID: 70426
User updated by: pet dot draexler at gmail dot com
Reported by: pet dot draexler at gmail dot com
Summary: fGetCsv() doesn't work with php://temp or
php://memory
-Status: Feedback
+Status: Open
Type: Bug
Package: Filesystem function related
Operating System: Windows 10
-PHP Version: 5.5.28
+PHP Version: 5.5.8
Block user comment: N
Private report: N
New Comment:
Code to test:
<?php
// To test this, you can use CSV file in this zip:
// http://spatialkeydocs.s3.amazonaws.com/FL_insurance_sample.csv.zip
$csv_file_content = file_get_contents("sample_file.csv");
$temp_file_name = "php://temp"; // when replaced with actual file name, everything works
file_put_contents($temp_file_name, $csv_file_content);
$handle = fopen($temp_file_name, "r");
$line = fGetCsv($handle, 1000, ",");
var_dump($line); // in PHP 5.5.8 returns echos bool(false)
?>
Previous Comments:
------------------------------------------------------------------------
[2015-09-04 09:22:54] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2015-09-04 09:22:14] pet dot draexler at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.fgetcsv
---
I received a CSV file through POST. When I wrote it into memory and tried to read it with fGetCsv,
it'd return FALSE. As soon as I changed php://temp to actual file name, everything is working.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70426&edit=1