-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preg_match(): Compilation failed: regular expression is too large at offset 156184 #8
Comments
I can't reproduce the compilation error with latest laminas-validator: ➜ laminas-validator git:(master) php -a
Interactive shell
php > include 'vendor/autoload.php';
php > var_dump((new Laminas\Validator\Hostname())->isValid('[email protected]'));
php shell code:1:
bool(false) I'm closing it. |
That’s strange, the same test on my machine leads to the warning mentioned above:
PHP Version:
|
ok, reopen it. |
It seems the compilation error too larget because of big regex at laminas-validator/src/Hostname/Biz.php Lines 25 to 2901 in 96529e8
|
Verified as well. Defaults for both INI values are 100000, as it turns out. I tried bumping each to 1000000, and still hit the limits. We're either going to need a separate validation for |
For quick fix, probably just check if string has "@" character... |
I created PR #67 for possible fix by handle if hostname has |
Possible fixes #8 compilation failed regex too large
This happens while using
Zend\Validator\Hostname->isValid('[email protected]')
because hostname/Biz.php contains enormous regular expressionTrace looks like this:
preg_match('/^[\x{002d}0-9a-z\x{3447}\x{3473}\x{359..(156088 chars skipped)..9FA0}\x{9FA2}\x{9FA4}\x{9FA5}]{1,20}$/iu','tapi4457@hsoqvf')
/vendor/zendframework/zend-validator/src/Hostname.php:1877
PHP Version 7.1.7
Originally posted by @ac-dc at zendframework/zend-validator#219
The text was updated successfully, but these errors were encountered: