Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- SplFileObject::fgetcsv with alternative delimiter --FILE-- <?php $fp = fopen('Spl..
Decoded Output download
--TEST--
SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
$fp = fopen('SplFileObject__fgetcsv3.csv', 'w+');
fputcsv($fp, array(
'field1',
'field2',
'field3',
5
), '|');
fclose($fp);
$fo = new SplFileObject('SplFileObject__fgetcsv3.csv');
try {
var_dump($fo->fgetcsv('invalid'));
} catch (ValueError $e) {
echo $e->getMessage(), "
";
}
?>
--CLEAN--
<?php
unlink('SplFileObject__fgetcsv3.csv');
?>
--EXPECT--
SplFileObject::fgetcsv(): Argument #1 ($separator) must be a single character
Did this file decode correctly?
Original Code
--TEST--
SplFileObject::fgetcsv with alternative delimiter
--FILE--
<?php
$fp = fopen('SplFileObject__fgetcsv3.csv', 'w+');
fputcsv($fp, array(
'field1',
'field2',
'field3',
5
), '|');
fclose($fp);
$fo = new SplFileObject('SplFileObject__fgetcsv3.csv');
try {
var_dump($fo->fgetcsv('invalid'));
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}
?>
--CLEAN--
<?php
unlink('SplFileObject__fgetcsv3.csv');
?>
--EXPECT--
SplFileObject::fgetcsv(): Argument #1 ($separator) must be a single character
Function Calls
fopen | 1 |
fputcsv | 1 |
Stats
MD5 | a4d0421f4e29f7b4c8e9483f87686fda |
Eval Count | 0 |
Decode Time | 89 ms |