> On 06 Jan 2016, at 18:03, Dan Ackroyd <dan...@basereality.com> wrote:
> 
> This is possibly a stupid question, but one that needs to be asked anyway:

Certainly not a stupid question.

> Have you checked that simply converting code that uses
> mb_eregi_replace to using mb_ereg_replace_callback with the i flag
> behaves the same in all circumstances?

Well the _callback function obviously behaves differently with regards to the, 
well, callback.

I haven’t actually tested it (kinda tough for “all situations”), but if we 
compare mb_eregi_replace with mb_ereg_replace with the i options is quite easy 
to see that they behave the same by looking at the source.

mb_eregi_replace 
(https://github.com/php/php-src/blob/master/ext/mbstring/php_mbregex.c#L1035) 
calls _php_mb_regex_ereg_replace_exec with the flag ONIG_OPTION_IGNORECASE 
(mb_ereg_replace calls the same function without that flag). When options are 
set on the function call, those are passed together with that flag to 
_php_mb_regex_init_options 
(https://github.com/php/php-src/blob/master/ext/mbstring/php_mbregex.c#L578) 
which sets the ONIG_OPTION_IGNORECASE when the i option is specified. After 
that both functions take exactly the same path.

I hope that clears it up.

Best regards
Rouven
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to