@@ -1948,26 +1948,29 @@ static int spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesystem_obje
1948
1948
}
1949
1949
if (SPL_HAS_FLAG (intern -> flags , SPL_FILE_OBJECT_READ_CSV )) {
1950
1950
return spl_filesystem_file_read_csv (intern , intern -> u .file .delimiter , intern -> u .file .enclosure , intern -> u .file .escape , NULL );
1951
- } else {
1952
- zend_execute_data * execute_data = EG (current_execute_data );
1953
- zend_call_method_with_0_params (Z_OBJ_P (this_ptr ), Z_OBJCE_P (ZEND_THIS ), & intern -> u .file .func_getCurr , "getCurrentLine" , & retval );
1954
1951
}
1955
- if (!Z_ISUNDEF (retval )) {
1956
- if (intern -> u .file .current_line || !Z_ISUNDEF (intern -> u .file .current_zval )) {
1957
- intern -> u .file .current_line_num ++ ;
1958
- }
1959
- spl_filesystem_file_free_line (intern );
1960
- if (Z_TYPE (retval ) == IS_STRING ) {
1961
- intern -> u .file .current_line = estrndup (Z_STRVAL (retval ), Z_STRLEN (retval ));
1962
- intern -> u .file .current_line_len = Z_STRLEN (retval );
1963
- } else {
1964
- ZVAL_COPY_DEREF (& intern -> u .file .current_zval , & retval );
1965
- }
1952
+
1953
+ zend_execute_data * execute_data = EG (current_execute_data );
1954
+ zend_call_method_with_0_params (Z_OBJ_P (this_ptr ), Z_OBJCE_P (ZEND_THIS ), & intern -> u .file .func_getCurr , "getCurrentLine" , & retval );
1955
+ if (Z_ISUNDEF (retval )) {
1956
+ return FAILURE ;
1957
+ }
1958
+
1959
+ if (Z_TYPE (retval ) != IS_STRING ) {
1960
+ zend_type_error ("getCurrentLine(): Return value must be of type string, %s returned" ,
1961
+ zend_zval_type_name (& retval ));
1966
1962
zval_ptr_dtor (& retval );
1967
- return SUCCESS ;
1968
- } else {
1969
1963
return FAILURE ;
1970
1964
}
1965
+
1966
+ if (intern -> u .file .current_line || !Z_ISUNDEF (intern -> u .file .current_zval )) {
1967
+ intern -> u .file .current_line_num ++ ;
1968
+ }
1969
+ spl_filesystem_file_free_line (intern );
1970
+ intern -> u .file .current_line = estrndup (Z_STRVAL (retval ), Z_STRLEN (retval ));
1971
+ intern -> u .file .current_line_len = Z_STRLEN (retval );
1972
+ zval_ptr_dtor (& retval );
1973
+ return SUCCESS ;
1971
1974
} else {
1972
1975
return spl_filesystem_file_read (intern , silent );
1973
1976
}
0 commit comments