mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #68825: Exception in DirectoryIterator::getLinkTarget()
This commit is contained in:
commit
3278b3347c
1
NEWS
1
NEWS
@ -25,6 +25,7 @@ PHP NEWS
|
||||
file). (Laruence)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #68825 (Exception in DirectoryIterator::getLinkTarget()). (cmb)
|
||||
. Fixed bug #68175 (RegexIterator pregFlags are NULL instead of 0). (Tim
|
||||
Siebels)
|
||||
|
||||
|
@ -1243,6 +1243,9 @@ SPL_METHOD(SplFileInfo, getLinkTarget)
|
||||
|
||||
zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling);
|
||||
|
||||
if (intern->file_name == NULL) {
|
||||
spl_filesystem_object_get_file_name(intern);
|
||||
}
|
||||
#if defined(PHP_WIN32) || HAVE_SYMLINK
|
||||
if (intern->file_name == NULL) {
|
||||
php_error_docref(NULL, E_WARNING, "Empty filename");
|
||||
|
25
ext/spl/tests/bug68825.phpt
Normal file
25
ext/spl/tests/bug68825.phpt
Normal file
@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #68825 (Exception in DirectoryIterator::getLinkTarget())
|
||||
--FILE--
|
||||
<?php
|
||||
$dir = __DIR__ . '/bug68825';
|
||||
mkdir($dir);
|
||||
symlink(__FILE__, "$dir/foo");
|
||||
|
||||
$di = new \DirectoryIterator($dir);
|
||||
foreach ($di as $entry) {
|
||||
if ('foo' === $entry->getFilename()) {
|
||||
var_dump($entry->getLinkTarget());
|
||||
}
|
||||
}
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
string(%d) "%s%eext%espl%etests%ebug68825.php"
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$dir = __DIR__ . '/bug68825';
|
||||
unlink("$dir/foo");
|
||||
rmdir($dir);
|
||||
?>
|
Loading…
Reference in New Issue
Block a user