Browse Source

- MFH: Fix Bug #42364 Crash when using getRealPath with DirectoryIterator

experimental/5.2-WITH_DRCP
Johannes Schlüter 19 years ago
parent
commit
254992907c
  1. 2
      NEWS
  2. 6
      ext/spl/spl_directory.c
  3. 18
      ext/spl/tests/bug42364.phpt

2
NEWS

@ -7,6 +7,8 @@ PHP NEWS
16 Aug 2007, PHP 5.2.4RC2
- Fixed oci8 and PDO_OCI extensions to allow configuring with Oracle 11g client
libraries. (Chris Jones)
- Fixed Bug #42364 (Crash when using getRealPath with DirectoryIterator).
(Johannes)
- Fixed bug #42292 ($PHP_CONFIG not set for phpized builds). (Jani)
- Fixed bug #42261 (header wrong for date field). (roberto at spadim dot com
dot br, Ilia)

6
ext/spl/spl_directory.c

@ -858,7 +858,11 @@ SPL_METHOD(SplFileInfo, getRealPath)
php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC);
if (VCWD_REALPATH(intern->file_name, buff)) {
if (intern->type == SPL_FS_DIR && !intern->file_name && intern->u.dir.entry.d_name[0]) {
spl_filesystem_object_get_file_name(intern TSRMLS_CC);
}
if (intern->file_name_len && VCWD_REALPATH(intern->file_name, buff)) {
#ifdef ZTS
if (VCWD_ACCESS(buff, F_OK)) {
RETVAL_FALSE;

18
ext/spl/tests/bug42364.phpt

@ -0,0 +1,18 @@
--TEST--
Bug #42364 (Crash when using getRealPath with DirectoryIterator)
--SKIPIF--
<?php if (!extension_loaded("spl")) print "skip"; ?>
--FILE--
<?php
$it = new DirectoryIterator(dirname(__FILE__));
foreach ($it as $e) {
if (gettype($e->getRealPath()) != "string") {
echo $e->getFilename(), " is a ", gettype($e->getRealPath()), "\n";
}
}
echo "===DONE==="
?>
--EXPECT--
===DONE===
Loading…
Cancel
Save