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

Unknown modifier error on the regex for uris that have an authority part #32

Open
mlambley opened this issue Apr 28, 2018 · 1 comment

Comments

@mlambley
Copy link

Sorry to hassle you again folks, but I'm running the tests on the project and am coming up against an issue with functions.php line 360.

Numerous tests are failing with the same issue, but I'm focusing on the "http://example.org:8080/" test.

I've pasted the relevant code into http://sandbox.onlinephpfunctions.com/ so that I can test it against different PHP versions. The code is:

<?php
$uri = '//example.org:8080/';
$regex = '
          %^
            //
            (?: (?<user> [^:@]+) (: (?<pass> [^@]+)) @)?
            (?<host> ( [^:/]* | \[ [^\]]+ \] ))
            (?: : (?<port> [0-9]+))?
            (?<path> / .*)?
          $%x
        ';
var_dump(preg_match($regex, $uri, $matches));
var_dump($matches);

The error I'm getting is:

<b>Warning</b>:  preg_match(): Unknown modifier '
' in <b>[...][...]</b> on line <b>12</b><br />
bool(false)
NULL

Any advice would be appreciated. Thank you.

@mlambley
Copy link
Author

mlambley commented Apr 28, 2018

Looks like this is another duplicate of #25
Peter's fix (removing the newlines from the beginning and end of the regex) seems to have fixed it.
Once that is merged this can be closed.

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

No branches or pull requests

1 participant