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-- Bug #75917 (SplFileObject::seek broken with CSV flags) --FILE-- <?php $expected =..

Decoded Output download

--TEST--
Bug #75917 (SplFileObject::seek broken with CSV flags)
--FILE--
<?php
$expected = [
    ['john', 'doe', '[email protected]', '0123456789'],
    ['jane', 'doe', '[email protected]'],
];

$tmp = new SplTempFileObject();
foreach ($expected as $row) {
    $tmp->fputcsv($row);
}
$tmp->setFlags(0);
$tmp->seek(23);
var_dump($tmp->current());

$tmp->setFlags(SplFileObject::READ_CSV | SplFileObject::SKIP_EMPTY);
$tmp->seek(23);
var_dump($tmp->current());
?>
--EXPECT--
bool(false)
bool(false)

Did this file decode correctly?

Original Code

--TEST--
Bug #75917 (SplFileObject::seek broken with CSV flags)
--FILE--
<?php
$expected = [
    ['john', 'doe', '[email protected]', '0123456789'],
    ['jane', 'doe', '[email protected]'],
];

$tmp = new SplTempFileObject();
foreach ($expected as $row) {
    $tmp->fputcsv($row);
}
$tmp->setFlags(0);
$tmp->seek(23);
var_dump($tmp->current());

$tmp->setFlags(SplFileObject::READ_CSV | SplFileObject::SKIP_EMPTY);
$tmp->seek(23);
var_dump($tmp->current());
?>
--EXPECT--
bool(false)
bool(false)

Function Calls

None

Variables

None

Stats

MD5 93e95bb24e9fb9cbfcfa3590a924e0ff
Eval Count 0
Decode Time 85 ms