php-src/ext/spl/tests/bug68557.phpt

43 lines
1.0 KiB
Plaintext
Raw Normal View History

2015-02-20 14:09:35 +00:00
--TEST--
Bug #68557 (SplFileInfo::getPathname() may be broken)
--FILE--
<?php
mkdir(__DIR__ . DIRECTORY_SEPARATOR . 'tmp');
touch(__DIR__ . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'a');
touch(__DIR__ . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'b');
$d = new DirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . 'tmp');
$d->seek(0);
2015-02-21 04:36:38 +00:00
$path0 = $d->current()->getPathname();
2015-02-20 14:09:35 +00:00
$d->seek(1);
2015-02-21 04:36:38 +00:00
$path1 = $d->current()->getPathname();
$d->seek(2);
$path2 = $d->current()->getPathname();
2015-02-20 14:09:35 +00:00
$d->seek(0);
2015-02-21 04:36:38 +00:00
var_dump($path0 === $d->current()->getPathname());
2015-02-20 14:09:35 +00:00
$d->seek(1);
2015-02-21 04:36:38 +00:00
var_dump($path1 === $d->current()->getPathname());
2015-02-20 14:09:35 +00:00
$d->seek(2);
2015-02-21 04:36:38 +00:00
var_dump($path2 === $d->current()->getPathname());
$d->seek(0);
var_dump($path0 === $d->current()->getPathname());
2015-02-20 14:09:35 +00:00
?>
--CLEAN--
<?php
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'a');
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'b');
rmdir(__DIR__ . DIRECTORY_SEPARATOR . 'tmp');
?>
--EXPECTF--
2015-02-21 04:36:38 +00:00
bool(true)
bool(true)
bool(true)
bool(true)