@ -391,7 +391,7 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_
return NULL ;
}
php_set _error_handling( EH_THROW , spl_ce_RuntimeException TSRMLS_CC ) ;
zend_replace _error_handling( EH_THROW , spl_ce_RuntimeException , NULL TSRMLS_CC ) ;
ce = ce ? ce : source - > info_class ;
return_value - > value . obj = spl_filesystem_object_new_ex ( ce , & intern TSRMLS_CC ) ;
@ -406,8 +406,6 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_
spl_filesystem_info_set_filename ( intern , file_path , file_path_len , use_copy TSRMLS_CC ) ;
}
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
return intern ;
} /* }}} */
@ -416,8 +414,9 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil
spl_filesystem_object * intern ;
zend_bool use_include_path = 0 ;
zval * arg1 , * arg2 ;
zend_error_handling error_handling ;
php_set _error_handling( EH_THROW , spl_ce_RuntimeException TSRMLS_CC ) ;
zend_replace _error_handling( EH_THROW , spl_ce_RuntimeException , & error_handling TSRMLS_CC ) ;
switch ( source - > type ) {
case SPL_FS_INFO :
@ -426,7 +425,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil
case SPL_FS_DIR :
if ( ! source - > u . dir . entry . d_name [ 0 ] ) {
zend_throw_exception_ex ( spl_ce_RuntimeException , 0 TSRMLS_CC , " Could not open file " ) ;
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
return NULL ;
}
}
@ -477,7 +476,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil
if ( ht & & zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " |sbr " ,
& intern - > u . file . open_mode , & intern - > u . file . open_mode_len ,
& use_include_path , & intern - > u . file . zcontext ) = = FAILURE ) {
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
intern - > u . file . open_mode = NULL ;
zval_dtor ( return_value ) ;
Z_TYPE_P ( return_value ) = IS_NULL ;
@ -485,7 +484,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil
}
if ( spl_filesystem_file_open ( intern , use_include_path , 0 TSRMLS_CC ) = = FAILURE ) {
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
zval_dtor ( return_value ) ;
Z_TYPE_P ( return_value ) = IS_NULL ;
return NULL ;
@ -493,11 +492,11 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil
}
break ;
case SPL_FS_DIR :
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
zend_throw_exception_ex ( spl_ce_RuntimeException , 0 TSRMLS_CC , " Operation not supported " ) ;
return NULL ;
}
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
return NULL ;
} /* }}} */
@ -605,7 +604,7 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, int ctor_flag
int parsed , len ;
long flags ;
php_set _error_handling( EH_THROW , spl_ce_UnexpectedValueException TSRMLS_CC ) ;
zend_replace _error_handling( EH_THROW , spl_ce_UnexpectedValueException , NULL TSRMLS_CC ) ;
if ( ctor_flags & DIT_CTOR_FLAGS ) {
flags = SPL_FILE_DIR_KEY_AS_PATHNAME | SPL_FILE_DIR_CURRENT_AS_FILEINFO ;
@ -621,11 +620,9 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, int ctor_flag
flags | = SPL_FILE_DIR_UNIXPATHS ;
}
if ( parsed = = FAILURE ) {
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
return ;
}
if ( ! len ) {
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
zend_throw_exception_ex ( spl_ce_RuntimeException , 0 TSRMLS_CC , " Directory name must not be empty. " ) ;
return ;
}
@ -642,7 +639,6 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, int ctor_flag
intern - > u . dir . is_recursive = instanceof_function ( intern - > std . ce , spl_ce_RecursiveDirectoryIterator TSRMLS_CC ) ? 1 : 0 ;
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
}
/* }}} */
@ -905,7 +901,7 @@ SPL_METHOD(DirectoryIterator, isDot)
/* {{{ proto void SplFileInfo::__construct(string file_name)
Cronstructs a new SplFileInfo from a path . */
/* php_set _error_handling() is used to throw exceptions in case
/* zend_replace _error_handling() is used to throw exceptions in case
the constructor fails . Here we use this to ensure the object
has a valid directory resource .
@ -918,10 +914,9 @@ SPL_METHOD(SplFileInfo, __construct)
char * path ;
int len ;
php_set _error_handling( EH_THROW , spl_ce_RuntimeException TSRMLS_CC ) ;
zend_replace _error_handling( EH_THROW , spl_ce_RuntimeException , NULL TSRMLS_CC ) ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & path , & len ) = = FAILURE ) {
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
return ;
}
@ -930,8 +925,6 @@ SPL_METHOD(SplFileInfo, __construct)
spl_filesystem_info_set_filename ( intern , path , len , 1 TSRMLS_CC ) ;
/* intern->type = SPL_FS_INFO; already set */
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
}
/* }}} */
@ -941,10 +934,9 @@ SPL_METHOD(SplFileInfo, func_name) \
{ \
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; \
\
php_set _error_handling( EH_THROW , spl_ce_RuntimeException TSRMLS_CC ) ; \
zend_replace _error_handling( EH_THROW , spl_ce_RuntimeException , NULL TSRMLS_CC ) ; \
spl_filesystem_object_get_file_name ( intern TSRMLS_CC ) ; \
php_stat ( intern - > file_name , intern - > file_name_len , func_num , return_value TSRMLS_CC ) ; \
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ; \
}
/* }}} */
@ -1031,7 +1023,7 @@ SPL_METHOD(SplFileInfo, getLinkTarget)
int ret ;
char buff [ MAXPATHLEN ] ;
php_set _error_handling( EH_THROW , spl_ce_RuntimeException TSRMLS_CC ) ;
zend_replace _error_handling( EH_THROW , spl_ce_RuntimeException , NULL TSRMLS_CC ) ;
# ifdef HAVE_SYMLINK
ret = readlink ( intern - > file_name , buff , MAXPATHLEN - 1 ) ;
@ -1048,7 +1040,6 @@ SPL_METHOD(SplFileInfo, getLinkTarget)
RETVAL_STRINGL ( buff , ret , 1 ) ;
}
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
}
/* }}} */
@ -1061,7 +1052,7 @@ SPL_METHOD(SplFileInfo, getRealPath)
char buff [ MAXPATHLEN ] ;
char * filename ;
php_set _error_handling( EH_THROW , spl_ce_RuntimeException TSRMLS_CC ) ;
zend_replace _error_handling( EH_THROW , spl_ce_RuntimeException , NULL TSRMLS_CC ) ;
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 ) ;
@ -1084,7 +1075,6 @@ SPL_METHOD(SplFileInfo, getRealPath)
} else {
RETVAL_FALSE ;
}
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
}
/* }}} */
# endif
@ -1106,13 +1096,11 @@ SPL_METHOD(SplFileInfo, setFileClass)
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
zend_class_entry * ce = spl_ce_SplFileObject ;
php_set _error_handling( EH_THROW , spl_ce_UnexpectedValueException TSRMLS_CC ) ;
zend_replace _error_handling( EH_THROW , spl_ce_UnexpectedValueException , NULL TSRMLS_CC ) ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " |C " , & ce ) = = SUCCESS ) {
intern - > file_class = ce ;
}
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
}
/* }}} */
@ -1123,13 +1111,11 @@ SPL_METHOD(SplFileInfo, setInfoClass)
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
zend_class_entry * ce = spl_ce_SplFileInfo ;
php_set _error_handling( EH_THROW , spl_ce_UnexpectedValueException TSRMLS_CC ) ;
zend_replace _error_handling( EH_THROW , spl_ce_UnexpectedValueException , NULL TSRMLS_CC ) ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " |C " , & ce ) = = SUCCESS ) {
intern - > info_class = ce ;
}
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
}
/* }}} */
@ -1140,13 +1126,11 @@ SPL_METHOD(SplFileInfo, getFileInfo)
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
zend_class_entry * ce = intern - > info_class ;
php_set _error_handling( EH_THROW , spl_ce_UnexpectedValueException TSRMLS_CC ) ;
zend_replace _error_handling( EH_THROW , spl_ce_UnexpectedValueException , NULL TSRMLS_CC ) ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " |C " , & ce ) = = SUCCESS ) {
spl_filesystem_object_create_type ( ht , intern , SPL_FS_INFO , ce , return_value TSRMLS_CC ) ;
}
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
}
/* }}} */
@ -1157,7 +1141,7 @@ SPL_METHOD(SplFileInfo, getPathInfo)
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
zend_class_entry * ce = intern - > info_class ;
php_set _error_handling( EH_THROW , spl_ce_UnexpectedValueException TSRMLS_CC ) ;
zend_replace _error_handling( EH_THROW , spl_ce_UnexpectedValueException , NULL TSRMLS_CC ) ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " |C " , & ce ) = = SUCCESS ) {
int path_len ;
@ -1166,8 +1150,6 @@ SPL_METHOD(SplFileInfo, getPathInfo)
spl_filesystem_object_create_info ( intern , path , path_len , 1 , ce , return_value TSRMLS_CC ) ;
}
}
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
}
/* }}} */
@ -1967,7 +1949,7 @@ SPL_METHOD(SplFileObject, __construct)
char * tmp_path ;
int tmp_path_len ;
php_set _error_handling( EH_THROW , spl_ce_RuntimeException TSRMLS_CC ) ;
zend_replace _error_handling( EH_THROW , spl_ce_RuntimeException , NULL TSRMLS_CC ) ;
intern - > u . file . open_mode = " r " ;
intern - > u . file . open_mode_len = 1 ;
@ -1976,7 +1958,6 @@ SPL_METHOD(SplFileObject, __construct)
& intern - > file_name , & intern - > file_name_len ,
& intern - > u . file . open_mode , & intern - > u . file . open_mode_len ,
& use_include_path , & intern - > u . file . zcontext ) = = FAILURE ) {
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
return ;
}
@ -2006,7 +1987,6 @@ SPL_METHOD(SplFileObject, __construct)
intern - > _path = estrndup ( intern - > u . file . stream - > orig_path , intern - > _path_len ) ;
}
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
} /* }}} */
/* {{{ proto void SplTempFileObject::__construct([int max_memory])
@ -2017,10 +1997,9 @@ SPL_METHOD(SplTempFileObject, __construct)
char tmp_fname [ 48 ] ;
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
php_set _error_handling( EH_THROW , spl_ce_RuntimeException TSRMLS_CC ) ;
zend_replace _error_handling( EH_THROW , spl_ce_RuntimeException , NULL TSRMLS_CC ) ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " |l " , & max_memory ) = = FAILURE ) {
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
return ;
}
@ -2042,8 +2021,6 @@ SPL_METHOD(SplTempFileObject, __construct)
intern - > _path_len = 0 ;
intern - > _path = estrndup ( " " , 0 ) ;
}
php_set_error_handling ( EH_NORMAL , NULL TSRMLS_CC ) ;
} /* }}} */
/* {{{ proto void SplFileObject::rewind()