Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

syntax error, unexpected token ")" #469

Open
BenOussama180 opened this issue Jun 23, 2022 · 9 comments
Open

syntax error, unexpected token ")" #469

BenOussama180 opened this issue Jun 23, 2022 · 9 comments

Comments

@BenOussama180
Copy link

This is the Error i get while creating a new instance of the Client :
image
It works locally, but not in production.
i use php 8.1 locally & 8.0.19 in prod so it should not be a syntax probleme.
when i checked prod's laravel logs it says this :
[2022-06-22 14:22:19] local.ERROR: syntax error, unexpected token ")" {"userId":2,"exception":"[object] (ParseError(code: 0): syntax error, unexpected token ")" at /home/749128.cloudwaysapps.com/maxxhthfnk/public_html/vendor/symfony/http-client/CurlHttpClient.php:68)

@stof
Copy link
Member

stof commented Jun 23, 2022

i use php 8.1 locally & 8.0.19 in prod so it should not be a syntax probleme.

Have you configured composer to resolve dependencies for PHP 8.0 ? If no, I'm almost sure that Composer installed symfony/http-client 6.1, which requires PHP 8.1 (and uses the first-class callable syntax)

@BenOussama180
Copy link
Author

Oh, i didnt know that, and how should i do that please @stof

@stof
Copy link
Member

stof commented Jun 23, 2022

@BenOussama180
Copy link
Author

https://getcomposer.org/doc/06-config.md#platform

Thanks alot, and what version of http-client should i install please? @stof

@stof
Copy link
Member

stof commented Jun 23, 2022

Composer will select the version compatible with the target PHP version (that's why it is important to tell it about the target if the runtime you use is not the target version).

@BenOussama180
Copy link
Author

so i should dump autoload after i add the platform under the config ?

@stof
Copy link
Member

stof commented Jun 23, 2022

you need to run composer update, to resolve dependencies again with the right target.

@rajivartifex
Copy link

rajivartifex commented Feb 21, 2023

@stof @BenOussama180 i run the composer update but same issue i m using php 8.0

@BenOussama180
Copy link
Author

@stof @BenOussama180 i run the composer update but same issue i m using php 8.0

i used spatie crawler which uses goute under the hood and i got no problem with it, i advice u to use it

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

No branches or pull requests

3 participants