@@ -853,16 +853,16 @@ PHP_FUNCTION(mb_regex_encoding)
853
853
/* {{{ _php_mb_regex_ereg_exec */
854
854
static void _php_mb_regex_ereg_exec (INTERNAL_FUNCTION_PARAMETERS , int icase )
855
855
{
856
- zval * arg_pattern , * array = NULL ;
857
- char * string ;
858
- size_t string_len ;
856
+ zval * array = NULL ;
857
+ char * arg_pattern , * string ;
858
+ size_t arg_pattern_len , string_len ;
859
859
php_mb_regex_t * re ;
860
860
OnigRegion * regs = NULL ;
861
861
int i , match_len , beg , end ;
862
862
OnigOptionType options ;
863
863
char * str ;
864
864
865
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "zs |z" , & arg_pattern , & string , & string_len , & array ) == FAILURE ) {
865
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "ss |z" , & arg_pattern , & arg_pattern_len , & string , & string_len , & array ) == FAILURE ) {
866
866
RETURN_FALSE ;
867
867
}
868
868
@@ -886,23 +886,13 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
886
886
options |= ONIG_OPTION_IGNORECASE ;
887
887
}
888
888
889
- /* compile the regular expression from the supplied regex */
890
- if (Z_TYPE_P (arg_pattern ) != IS_STRING ) {
891
- /* we convert numbers to integers and treat them as a string */
892
- if (Z_TYPE_P (arg_pattern ) == IS_DOUBLE ) {
893
- convert_to_long_ex (arg_pattern ); /* get rid of decimal places */
894
- }
895
- convert_to_string_ex (arg_pattern );
896
- /* don't bother doing an extended regex with just a number */
897
- }
898
-
899
- if (Z_STRLEN_P (arg_pattern ) == 0 ) {
889
+ if (arg_pattern_len == 0 ) {
900
890
php_error_docref (NULL , E_WARNING , "empty pattern" );
901
891
RETVAL_FALSE ;
902
892
goto out ;
903
893
}
904
894
905
- re = php_mbregex_compile_pattern (Z_STRVAL_P ( arg_pattern ), Z_STRLEN_P ( arg_pattern ) , options , MBREX (current_mbctype ), MBREX (regex_default_syntax ));
895
+ re = php_mbregex_compile_pattern (arg_pattern , arg_pattern_len , options , MBREX (current_mbctype ), MBREX (regex_default_syntax ));
906
896
if (re == NULL ) {
907
897
RETVAL_FALSE ;
908
898
goto out ;
0 commit comments