colder Tue, 27 Apr 2010 08:56:01 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=298647
Log: Fixed #48361 (SplFileInfo::getPathName() should return the parent Bug: http://bugs.php.net/48361 (Assigned) SplFileInfo::getPathinfo no returning info of path Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c A php/php-src/branches/PHP_5_3/ext/spl/tests/bug48361.phpt U php/php-src/trunk/ext/spl/spl_directory.c A php/php-src/trunk/ext/spl/tests/bug48361.phpt Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2010-04-27 08:45:23 UTC (rev 298646) +++ php/php-src/branches/PHP_5_3/NEWS 2010-04-27 08:56:01 UTC (rev 298647) @@ -106,6 +106,8 @@ - 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) Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c 2010-04-27 08:45:23 UTC (rev 298646) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c 2010-04-27 08:56:01 UTC (rev 298647) @@ -1187,7 +1187,10 @@ 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); } } Added: php/php-src/branches/PHP_5_3/ext/spl/tests/bug48361.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/spl/tests/bug48361.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/spl/tests/bug48361.phpt 2010-04-27 08:56:01 UTC (rev 298647) @@ -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=== + Modified: php/php-src/trunk/ext/spl/spl_directory.c =================================================================== --- php/php-src/trunk/ext/spl/spl_directory.c 2010-04-27 08:45:23 UTC (rev 298646) +++ php/php-src/trunk/ext/spl/spl_directory.c 2010-04-27 08:56:01 UTC (rev 298647) @@ -1187,7 +1187,10 @@ 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); } } Added: php/php-src/trunk/ext/spl/tests/bug48361.phpt =================================================================== --- php/php-src/trunk/ext/spl/tests/bug48361.phpt (rev 0) +++ php/php-src/trunk/ext/spl/tests/bug48361.phpt 2010-04-27 08:56:01 UTC (rev 298647) @@ -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=== +
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php