mirror of
https://github.com/php/php-src.git
synced 2024-11-28 04:14:26 +08:00
Fixed #48361 (SplFileInfo::getPathName() should return the parent
This commit is contained in:
parent
8525f7bb02
commit
a5d361e3ea
2
NEWS
2
NEWS
@ -106,6 +106,8 @@ PHP NEWS
|
||||
- Fixed bug #48983 (DomDocument : saveHTMLFile wrong charset). (Rob)
|
||||
- Fixed bug #48902 (Timezone database fallback map is outdated). (Derick)
|
||||
- Fixed bug #48781 (Cyclical garbage collector memory leak). (Dmitry)
|
||||
- Fixed bug #48361 (SplFileInfo::getPathInfo should return the
|
||||
parent dir). (Etienne)
|
||||
- Fixed bug #46111 (Some timezone identifiers can not be parsed). (Derick)
|
||||
- Fixed bug #35673 (formatOutput does not work with saveHTML). (Rob)
|
||||
|
||||
|
@ -1187,7 +1187,10 @@ SPL_METHOD(SplFileInfo, getPathInfo)
|
||||
int path_len;
|
||||
char *path = spl_filesystem_object_get_pathname(intern, &path_len TSRMLS_CC);
|
||||
if (path) {
|
||||
spl_filesystem_object_create_info(intern, path, path_len, 1, ce, return_value TSRMLS_CC);
|
||||
char *dpath = estrndup(path, path_len);
|
||||
path_len = php_dirname(dpath, path_len);
|
||||
spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value TSRMLS_CC);
|
||||
efree(dpath);
|
||||
}
|
||||
}
|
||||
|
||||
|
14
ext/spl/tests/bug48361.phpt
Normal file
14
ext/spl/tests/bug48361.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
SPL: Bug #48361 SpleFileInfo::getPathName should return the dirname's path
|
||||
--FILE--
|
||||
<?php
|
||||
$info = new SplFileInfo(__FILE__);
|
||||
var_dump($info->getRealPath());
|
||||
var_dump($info->getPathInfo()->getRealPath());
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
string(%d) "%stests%sbug48361.php"
|
||||
string(%d) "%stests"
|
||||
===DONE===
|
||||
|
Loading…
Reference in New Issue
Block a user