@@ -518,7 +518,7 @@ PHP_FUNCTION(mb_regex_encoding)
518
518
static void _php_mb_regex_ereg_exec (INTERNAL_FUNCTION_PARAMETERS , int icase )
519
519
{
520
520
zval tmp ;
521
- zval * arg_pattern , * array ;
521
+ zval * * arg_pattern , * array ;
522
522
char * string ;
523
523
int string_len ;
524
524
php_mb_regex_t * re ;
@@ -529,7 +529,7 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
529
529
530
530
array = NULL ;
531
531
532
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "zs |z" , & arg_pattern , & string , & string_len , & array ) == FAILURE ) {
532
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "Zs |z" , & arg_pattern , & string , & string_len , & array ) == FAILURE ) {
533
533
RETURN_FALSE ;
534
534
}
535
535
@@ -539,18 +539,15 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
539
539
}
540
540
541
541
/* compile the regular expression from the supplied regex */
542
- if (Z_TYPE_P (arg_pattern ) != IS_STRING ) {
542
+ if (Z_TYPE_PP (arg_pattern ) != IS_STRING ) {
543
543
/* we convert numbers to integers and treat them as a string */
544
- tmp = * arg_pattern ;
545
- zval_copy_ctor (& tmp );
546
- if (Z_TYPE_P (& tmp ) == IS_DOUBLE ) {
547
- convert_to_long (& tmp ); /* get rid of decimal places */
544
+ if (Z_TYPE_PP (arg_pattern ) == IS_DOUBLE ) {
545
+ convert_to_long_ex (arg_pattern ); /* get rid of decimal places */
548
546
}
549
- convert_to_string (& tmp );
550
- arg_pattern = & tmp ;
547
+ convert_to_string_ex (arg_pattern );
551
548
/* don't bother doing an extended regex with just a number */
552
549
}
553
- re = php_mbregex_compile_pattern (Z_STRVAL_P (arg_pattern ), Z_STRLEN_P (arg_pattern ), options , MBSTRG (current_mbctype ), MBSTRG (regex_default_syntax ) TSRMLS_CC );
550
+ re = php_mbregex_compile_pattern (Z_STRVAL_PP (arg_pattern ), Z_STRLEN_PP (arg_pattern ), options , MBSTRG (current_mbctype ), MBSTRG (regex_default_syntax ) TSRMLS_CC );
554
551
if (re == NULL ) {
555
552
RETVAL_FALSE ;
556
553
goto out ;
@@ -590,9 +587,6 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
590
587
if (regs != NULL ) {
591
588
onig_region_free (regs , 1 );
592
589
}
593
- if (arg_pattern == & tmp ) {
594
- zval_dtor (& tmp );
595
- }
596
590
}
597
591
/* }}} */
598
592
0 commit comments