Skip to content
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

PCRE_UTF8 modifier causes "Warning: Unknown error" on first run #2925

Closed
atdt opened this issue Jun 12, 2014 · 2 comments
Closed

PCRE_UTF8 modifier causes "Warning: Unknown error" on first run #2925

atdt opened this issue Jun 12, 2014 · 2 comments

Comments

@atdt
Copy link
Contributor

atdt commented Jun 12, 2014

To reproduce:

<?php preg_split('//u', 'x'); exit(error_get_last() ? 1 : 0);

The first time this is run, the output is:

Warning: Unknown error in /home/ori/bug66386.php on line 1
    #0 at [/home/ori/bug66386.php:1]

There is no error on subsequent invocations. If I make a modification to the file (including adding whitespace), the error recurs. So I imagine it is an artifact of compilation.

@ptarjan
Copy link
Contributor

ptarjan commented Jun 12, 2014

I can't repo with my version of preg.

I'm assuming it comes from this line:

raise_warning("Unknown error");
(you can use gdb and set a breakpoint on raise_error to make sure).

And yes, it looks like the regex cache is kicking in? I don't have much... is this blocking something?

@atdt
Copy link
Contributor Author

atdt commented Jun 12, 2014

Yep, it's a blocker, and yes, that's the line. The value returned from pcre_exec is -21, which is:

PCRE_ERROR_RECURSIONLIMIT (-21)

       The internal recursion limit, as specified by the match_limit_recursion
       field in a pcre_extra structure (or defaulted)  was  reached.  See  the
       description above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants