@@ -2552,12 +2552,12 @@ PHP_METHOD(SplFileObject, flock)
2552
2552
spl_filesystem_object * intern = Z_SPLFILESYSTEM_P (ZEND_THIS );
2553
2553
zend_function * func_ptr ;
2554
2554
2555
- func_ptr = (zend_function * )zend_hash_str_find_ptr (EG (function_table ), "flock" , sizeof ("flock" ) - 1 );
2556
- if (func_ptr == NULL ) {
2555
+ func_ptr = (zend_function * )zend_hash_str_find_ptr (EG (function_table ), "flock" , sizeof ("flock" ) - 1 );
2556
+ if (func_ptr == NULL ) {
2557
2557
zend_throw_exception_ex (spl_ce_RuntimeException , 0 , "Internal error, function flock() not found. Please report" );
2558
2558
RETURN_THROWS ();
2559
- }
2560
- spl_filesystem_file_call (intern , func_ptr , ZEND_NUM_ARGS (), return_value );
2559
+ }
2560
+ spl_filesystem_file_call (intern , func_ptr , ZEND_NUM_ARGS (), return_value );
2561
2561
}
2562
2562
/* }}} */
2563
2563
@@ -2669,12 +2669,12 @@ PHP_METHOD(SplFileObject, fscanf)
2669
2669
spl_filesystem_file_free_line (intern );
2670
2670
intern -> u .file .current_line_num ++ ;
2671
2671
2672
- func_ptr = (zend_function * )zend_hash_str_find_ptr (EG (function_table ), "fscanf" , sizeof ("fscanf" ) - 1 );
2673
- if (func_ptr == NULL ) {
2672
+ func_ptr = (zend_function * )zend_hash_str_find_ptr (EG (function_table ), "fscanf" , sizeof ("fscanf" ) - 1 );
2673
+ if (func_ptr == NULL ) {
2674
2674
zend_throw_exception_ex (spl_ce_RuntimeException , 0 , "Internal error, function fscanf() not found. Please report" );
2675
2675
RETURN_THROWS ();
2676
- }
2677
- spl_filesystem_file_call (intern , func_ptr , ZEND_NUM_ARGS (), return_value );
2676
+ }
2677
+ spl_filesystem_file_call (intern , func_ptr , ZEND_NUM_ARGS (), return_value );
2678
2678
}
2679
2679
/* }}} */
2680
2680
@@ -2748,12 +2748,22 @@ PHP_METHOD(SplFileObject, fstat)
2748
2748
spl_filesystem_object * intern = Z_SPLFILESYSTEM_P (ZEND_THIS );
2749
2749
zend_function * func_ptr ;
2750
2750
2751
- func_ptr = (zend_function * )zend_hash_str_find_ptr (EG (function_table ), "fstat" , sizeof ("fstat" ) - 1 );
2752
- if (func_ptr == NULL ) {
2751
+ if (zend_parse_parameters_none () == FAILURE ) {
2752
+ RETURN_THROWS ();
2753
+ }
2754
+
2755
+ func_ptr = (zend_function * )zend_hash_str_find_ptr (EG (function_table ), "fstat" , sizeof ("fstat" ) - 1 );
2756
+ if (func_ptr == NULL ) {
2753
2757
zend_throw_exception_ex (spl_ce_RuntimeException , 0 , "Internal error, function fstat() not found. Please report" );
2754
2758
RETURN_THROWS ();
2755
- }
2756
- spl_filesystem_file_call (intern , func_ptr , ZEND_NUM_ARGS (), return_value );
2759
+ }
2760
+
2761
+ if (Z_ISUNDEF_P (& intern -> u .file .zresource )) {
2762
+ zend_throw_exception_ex (spl_ce_RuntimeException , 0 , "Object not initialized" );
2763
+ RETURN_THROWS ();
2764
+ }
2765
+
2766
+ zend_call_known_function (func_ptr , NULL , NULL , return_value , 0 , NULL , NULL );
2757
2767
}
2758
2768
/* }}} */
2759
2769
0 commit comments