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

Warning: preg_match(): Unknown modifier '/' in SetCookie.php on line 352 #1720

Closed
turkelt0n opened this issue Jan 9, 2017 · 3 comments
Closed

Comments

@turkelt0n
Copy link

Hi! I've got some Error using a simple Request

$values["region"]` = "12345_DE";
$cookieJar = CookieJar::fromArray(
    $values,
    "https://www.allyouneedfresh.de"
);

$client = new \GuzzleHttp\Client(['cookies' => $cookieJar]);
$response = $client->get(
    "https://www.allyouneedfresh.de"
);

This results in

Warning: preg_match(): Unknown modifier '/'
() at /home/alex/foodle/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php:352
 GuzzleHttp\Cookie\SetCookie->matchesDomain() at /home/foodle/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php:234
...

The Error is thrown for every URL i tried. Any Suggestions? Did I miss something?

Thank you!

@sagikazarmark
Copy link
Member

The cookie jar domain must be without the schema part, so:

$cookieJar = CookieJar::fromArray(
    $values,
    "www.allyouneedfresh.de"
);

@turkelt0n
Copy link
Author

Thank you for that!

@curtisdf
Copy link

I know this is from a year ago, but the discussion above does not address the underlying bug in the code. There are servers on the Interwebs that are sending invalid domain strings, which wreaks havoc with Guzzle when trying to parse those cookies.

I have submitted a pull request which fixes the bug in SetCookie::matchesDomain(). See #1999.

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

No branches or pull requests

3 participants