@@ -1944,17 +1944,6 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
1944
1944
return result ;
1945
1945
} /* }}} */
1946
1946
1947
- #define FileFunctionCall (func_name , pass_num_args ) /* {{{ */ \
1948
- { \
1949
- zend_function *func_ptr; \
1950
- func_ptr = (zend_function *)zend_hash_str_find_ptr(EG(function_table), #func_name, sizeof(#func_name) - 1); \
1951
- if (func_ptr == NULL) { \
1952
- zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Internal error, function %s() not found. Please report", #func_name); \
1953
- return; \
1954
- } \
1955
- spl_filesystem_file_call(intern, func_ptr, pass_num_args, return_value); \
1956
- } /* }}} */
1957
-
1958
1947
static int spl_filesystem_file_read_csv (spl_filesystem_object * intern , char delimiter , char enclosure , int escape , zval * return_value ) /* {{{ */
1959
1948
{
1960
1949
int ret = SUCCESS ;
@@ -2561,7 +2550,14 @@ PHP_METHOD(SplFileObject, getCsvControl)
2561
2550
PHP_METHOD (SplFileObject , flock )
2562
2551
{
2563
2552
spl_filesystem_object * intern = Z_SPLFILESYSTEM_P (ZEND_THIS );
2564
- FileFunctionCall (flock , ZEND_NUM_ARGS ());
2553
+ zend_function * func_ptr ;
2554
+
2555
+ func_ptr = (zend_function * )zend_hash_str_find_ptr (EG (function_table ), "flock" , sizeof ("flock" ) - 1 );
2556
+ if (func_ptr == NULL ) {
2557
+ zend_throw_exception_ex (spl_ce_RuntimeException , 0 , "Internal error, function flock() not found. Please report" );
2558
+ RETURN_THROWS ();
2559
+ }
2560
+ spl_filesystem_file_call (intern , func_ptr , ZEND_NUM_ARGS (), return_value );
2565
2561
}
2566
2562
/* }}} */
2567
2563
@@ -2663,6 +2659,7 @@ PHP_METHOD(SplFileObject, fpassthru)
2663
2659
PHP_METHOD (SplFileObject , fscanf )
2664
2660
{
2665
2661
spl_filesystem_object * intern = Z_SPLFILESYSTEM_P (ZEND_THIS );
2662
+ zend_function * func_ptr ;
2666
2663
2667
2664
if (!intern -> u .file .stream ) {
2668
2665
zend_throw_exception_ex (spl_ce_RuntimeException , 0 , "Object not initialized" );
@@ -2672,7 +2669,12 @@ PHP_METHOD(SplFileObject, fscanf)
2672
2669
spl_filesystem_file_free_line (intern );
2673
2670
intern -> u .file .current_line_num ++ ;
2674
2671
2675
- FileFunctionCall (fscanf , ZEND_NUM_ARGS ());
2672
+ func_ptr = (zend_function * )zend_hash_str_find_ptr (EG (function_table ), "fscanf" , sizeof ("fscanf" ) - 1 );
2673
+ if (func_ptr == NULL ) {
2674
+ zend_throw_exception_ex (spl_ce_RuntimeException , 0 , "Internal error, function fscanf() not found. Please report" );
2675
+ RETURN_THROWS ();
2676
+ }
2677
+ spl_filesystem_file_call (intern , func_ptr , ZEND_NUM_ARGS (), return_value );
2676
2678
}
2677
2679
/* }}} */
2678
2680
@@ -2744,7 +2746,14 @@ PHP_METHOD(SplFileObject, fread)
2744
2746
PHP_METHOD (SplFileObject , fstat )
2745
2747
{
2746
2748
spl_filesystem_object * intern = Z_SPLFILESYSTEM_P (ZEND_THIS );
2747
- FileFunctionCall (fstat , ZEND_NUM_ARGS ());
2749
+ zend_function * func_ptr ;
2750
+
2751
+ func_ptr = (zend_function * )zend_hash_str_find_ptr (EG (function_table ), "fstat" , sizeof ("fstat" ) - 1 );
2752
+ if (func_ptr == NULL ) {
2753
+ zend_throw_exception_ex (spl_ce_RuntimeException , 0 , "Internal error, function fstat() not found. Please report" );
2754
+ RETURN_THROWS ();
2755
+ }
2756
+ spl_filesystem_file_call (intern , func_ptr , ZEND_NUM_ARGS (), return_value );
2748
2757
}
2749
2758
/* }}} */
2750
2759
0 commit comments