|
29 | 29 | #include "ext/standard/url.h"
|
30 | 30 | #include "main/php_output.h"
|
31 | 31 | #include "ext/standard/info.h"
|
| 32 | +#include "ext/pcre/php_pcre.h" |
32 | 33 |
|
33 | 34 | #include "libmbfl/mbfl/mbfilter_8bit.h"
|
34 | 35 | #include "libmbfl/mbfl/mbfilter_pass.h"
|
|
52 | 53 |
|
53 | 54 | #ifdef HAVE_MBREGEX
|
54 | 55 | # include "php_mbregex.h"
|
55 |
| -# include "php_onig_compat.h" |
56 |
| -# include <oniguruma.h> |
57 |
| -# undef UChar |
58 |
| -# if !defined(ONIGURUMA_VERSION_INT) || ONIGURUMA_VERSION_INT < 60800 |
59 |
| -typedef void OnigMatchParam; |
60 |
| -#define onig_new_match_param() (NULL) |
61 |
| -#define onig_initialize_match_param(x) (void)(x) |
62 |
| -#define onig_set_match_stack_limit_size_of_match_param(x, y) |
63 |
| -#define onig_set_retry_limit_in_match_of_match_param(x, y) |
64 |
| -#define onig_free_match_param(x) |
65 |
| -#define onig_search_with_param(reg, str, end, start, range, region, option, mp) \ |
66 |
| -onig_search(reg, str, end, start, range, region, option) |
67 |
| -#define onig_match_with_param(re, str, end, at, region, option, mp) \ |
68 |
| -onig_match(re, str, end, at, region, option) |
69 |
| -# endif |
70 |
| -#else |
71 |
| -# include "ext/pcre/php_pcre.h" |
72 | 56 | #endif
|
73 | 57 |
|
74 | 58 | #include "zend_multibyte.h"
|
@@ -513,60 +497,6 @@ static zend_multibyte_functions php_mb_zend_multibyte_functions = {
|
513 | 497 | };
|
514 | 498 | /* }}} */
|
515 | 499 |
|
516 |
| -static void *_php_mb_compile_regex(const char *pattern); |
517 |
| -static int _php_mb_match_regex(void *opaque, const char *str, size_t str_len); |
518 |
| -static void _php_mb_free_regex(void *opaque); |
519 |
| - |
520 |
| -#ifdef HAVE_MBREGEX |
521 |
| -/* {{{ _php_mb_compile_regex */ |
522 |
| -static void *_php_mb_compile_regex(const char *pattern) |
523 |
| -{ |
524 |
| - php_mb_regex_t *retval; |
525 |
| - OnigErrorInfo err_info; |
526 |
| - int err_code; |
527 |
| - |
528 |
| - if ((err_code = onig_new(&retval, |
529 |
| - (const OnigUChar *)pattern, |
530 |
| - (const OnigUChar *)pattern + strlen(pattern), |
531 |
| - ONIG_OPTION_IGNORECASE | ONIG_OPTION_DONT_CAPTURE_GROUP, |
532 |
| - ONIG_ENCODING_ASCII, &OnigSyntaxPerl, &err_info))) { |
533 |
| - OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; |
534 |
| - onig_error_code_to_str(err_str, err_code, err_info); |
535 |
| - php_error_docref(NULL, E_WARNING, "%s: %s", pattern, err_str); |
536 |
| - retval = NULL; |
537 |
| - } |
538 |
| - return retval; |
539 |
| -} |
540 |
| -/* }}} */ |
541 |
| - |
542 |
| -/* {{{ _php_mb_match_regex */ |
543 |
| -static int _php_mb_match_regex(void *opaque, const char *str, size_t str_len) |
544 |
| -{ |
545 |
| - OnigMatchParam *mp = onig_new_match_param(); |
546 |
| - int err; |
547 |
| - onig_initialize_match_param(mp); |
548 |
| - if (!ZEND_LONG_UINT_OVFL(MBSTRG(regex_stack_limit))) { |
549 |
| - onig_set_match_stack_limit_size_of_match_param(mp, (unsigned int)MBSTRG(regex_stack_limit)); |
550 |
| - } |
551 |
| - if (!ZEND_LONG_UINT_OVFL(MBSTRG(regex_retry_limit))) { |
552 |
| - onig_set_retry_limit_in_match_of_match_param(mp, (unsigned int)MBSTRG(regex_retry_limit)); |
553 |
| - } |
554 |
| - /* search */ |
555 |
| - err = onig_search_with_param((php_mb_regex_t *)opaque, (const OnigUChar *)str, |
556 |
| - (const OnigUChar*)str + str_len, (const OnigUChar *)str, |
557 |
| - (const OnigUChar*)str + str_len, NULL, ONIG_OPTION_NONE, mp); |
558 |
| - onig_free_match_param(mp); |
559 |
| - return err >= 0; |
560 |
| -} |
561 |
| -/* }}} */ |
562 |
| - |
563 |
| -/* {{{ _php_mb_free_regex */ |
564 |
| -static void _php_mb_free_regex(void *opaque) |
565 |
| -{ |
566 |
| - onig_free((php_mb_regex_t *)opaque); |
567 |
| -} |
568 |
| -/* }}} */ |
569 |
| -#else |
570 | 500 | /* {{{ _php_mb_compile_regex */
|
571 | 501 | static void *_php_mb_compile_regex(const char *pattern)
|
572 | 502 | {
|
@@ -608,7 +538,6 @@ static void _php_mb_free_regex(void *opaque)
|
608 | 538 | pcre2_code_free(opaque);
|
609 | 539 | }
|
610 | 540 | /* }}} */
|
611 |
| -#endif |
612 | 541 |
|
613 | 542 | /* {{{ php_mb_nls_get_default_detect_order_list */
|
614 | 543 | static int php_mb_nls_get_default_detect_order_list(enum mbfl_no_language lang, enum mbfl_no_encoding **plist, size_t *plist_size)
|
|
0 commit comments