@@ -1443,7 +1443,6 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
1443
1443
case IS_OBJECT :
1444
1444
if (instanceof_function (Z_OBJCE_P (value ), spl_ce_SplFileInfo )) {
1445
1445
char * test = NULL ;
1446
- zval dummy ;
1447
1446
spl_filesystem_object * intern = (spl_filesystem_object * )((char * )Z_OBJ_P (value ) - Z_OBJ_P (value )-> handlers -> offset );
1448
1447
1449
1448
if (!base_len ) {
@@ -1455,9 +1454,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
1455
1454
case SPL_FS_DIR :
1456
1455
test = spl_filesystem_object_get_path (intern , NULL );
1457
1456
fname_len = spprintf (& fname , 0 , "%s%c%s" , test , DEFAULT_SLASH , intern -> u .dir .entry .d_name );
1458
- php_stat (fname , fname_len , FS_IS_DIR , & dummy );
1459
-
1460
- if (Z_TYPE (dummy ) == IS_TRUE ) {
1457
+ if (php_stream_stat_path (fname , & ssb ) == 0 && S_ISDIR (ssb .sb .st_mode )) {
1461
1458
/* ignore directories */
1462
1459
efree (fname );
1463
1460
return ZEND_HASH_APPLY_KEEP ;
@@ -1478,7 +1475,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
1478
1475
goto phar_spl_fileinfo ;
1479
1476
case SPL_FS_INFO :
1480
1477
case SPL_FS_FILE :
1481
- fname = expand_filepath (intern -> file_name , NULL );
1478
+ fname = expand_filepath (ZSTR_VAL ( intern -> file_name ) , NULL );
1482
1479
if (!fname ) {
1483
1480
zend_throw_exception_ex (spl_ce_UnexpectedValueException , 0 , "Could not resolve file path" );
1484
1481
return ZEND_HASH_APPLY_STOP ;
@@ -4644,11 +4641,11 @@ PHP_METHOD(PharFileInfo, chmod)
4644
4641
/* hackish cache in php_stat needs to be cleared */
4645
4642
/* if this code fails to work, check main/streams/streams.c, _php_stream_stat_path */
4646
4643
if (BG (CurrentLStatFile )) {
4647
- efree (BG (CurrentLStatFile ));
4644
+ zend_string_release (BG (CurrentLStatFile ));
4648
4645
}
4649
4646
4650
4647
if (BG (CurrentStatFile )) {
4651
- efree (BG (CurrentStatFile ));
4648
+ zend_string_release (BG (CurrentStatFile ));
4652
4649
}
4653
4650
4654
4651
BG (CurrentLStatFile ) = NULL ;
0 commit comments