You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ini setting doesn't work as expected when setting has regex expressions
My customized ini file has string with regular expressions like below
Case 1:
Ini setting value :
abc=[Tt][Oo][Kk][Ee][Nn].,^[Qq],one, two
php -I |grep abc shows
myextension.abc=> 0 => 0
But I expected this output instead:
php -I |grep abc shows
myextension.abc=> [Tt][Oo][Kk][Ee][Nn].,^[Qq],one, two =>[Tt][Oo][Kk][Ee][Nn].,^[Qq],one, two
Case 2:
Ini setting value :
abc=[Tt][Oo][Kk][Ee][Nn].
Case 3:
Ini setting value :
abc=.^[Qq]$
php -I |grep abc shows
PHP: syntax error, unexpected '=' myextension.ini on line 9
myextension.abc=> 0 =>0
Is there any limitation with regex expressions in php ini settings. Though It seems like carrot ^ and $ dollar sign doesn't seems to work with string ini setting.
PHP Version
PHP 8.1
Operating System
No response
The text was updated successfully, but these errors were encountered:
PHP understands some special characters in INI files. ^ is one of them, and acts as an XOR operator; it's meant to be used with bitmask fields like error_reporting. $ is another, in that can be used for interpolating variables and so gets its own treatment during parsing.
If you want special characters like those then the value needs to be quoted.
abc="[Tt][Oo][Kk][Ee][Nn].,^[Qq],one, two"
If you need a " itself, escape it with a backslash.
Description
The ini setting doesn't work as expected when setting has regex expressions
My customized ini file has string with regular expressions like below
Case 1:
Ini setting value :
abc=[Tt][Oo][Kk][Ee][Nn].,^[Qq],one, two
php -I |grep abc shows
myextension.abc=> 0 => 0
But I expected this output instead:
php -I |grep abc shows
myextension.abc=> [Tt][Oo][Kk][Ee][Nn].,^[Qq],one, two =>[Tt][Oo][Kk][Ee][Nn].,^[Qq],one, two
Case 2:
Ini setting value :
abc=[Tt][Oo][Kk][Ee][Nn].
php -I |grep abc shows
myextension.abc=> [Tt][Oo][Kk][Ee][Nn].=>[Tt][Oo][Kk][Ee][Nn].
Case 3:
Ini setting value :
abc=.^[Qq]$
php -I |grep abc shows
PHP: syntax error, unexpected '=' myextension.ini on line 9
myextension.abc=> 0 =>0
Is there any limitation with regex expressions in php ini settings. Though It seems like carrot ^ and $ dollar sign doesn't seems to work with string ini setting.
PHP Version
PHP 8.1
Operating System
No response
The text was updated successfully, but these errors were encountered: