Still struggling to get Grav to work: 0 - syntax error, unexpected token "match"


I have managed to get php v8 working and my URL Rewrites working (I think) on my Grav site on Windows 10 IIS 10.0

I downloaded a skeleton, and extracted the files into my wwwroot folder.
When I browse to the site I get the following error: 0 - syntax error, unexpected token "match"

I turned on full backtrace for error logging and the issue seems to lie in the C:\inetpub\wwwroot\grav-skeleton-landio-site\vendor\willdurand\negotiation\src\Negotiation\Negotiator.php file:

I have tried this with two skeletons, and the error is the same.

Any ideas?

Hi Nemza,

I’ve got the same error " unexpected token “match”", with a different skeleton (kb).
I’m on WIndows 10 and using php directly.

Did you figure out how to fix this error ?

Thanks for your help.

I just registed to reply because I had the same problem. The issue is that in php8 the Match word used in willdurand/negotiation is reserved so it fails. You have to use +3.0.0 version.

Edit your composer.json and replace something like:

“willdurand/negotiation”: “^2.3”


“willdurand/negotiation”: “^3.0”

Then reinstall composer dependencies and it should work.


1 Like

@phproberto, I think you have indeed pinpointed the issue, but… I’m not sure your proposed solution is the best way to go.

It appears that skeleton Landio and others are installed with Grav 1.6.28 and not the latest Grav 1.7.+.

Grav 1.6.28 requires "willdurand/negotiation": "2.x-dev", while Grav 1.7.+ requires "willdurand/negotiation": "^3.0",.

My suggestion would be to upgrade Grav to 1.7.+ and upgrade the themes/plugins using:

  • Upgrade Grav: $ bin/gpm selfupgrade
  • Upgrade themes/plugins: $ bin/gpm update

Thanks @pamtbaau ! You are right. It’s always bettter to upgrade Grav. I use Grav ocasionally and I didn’t knew there was a new version shipping v3.0 of the negotiation library.

Thank you for taking the time for writing this. I’m sure it will help other users.

Thanks for the responses everyone!
I’ve been AFK, and will try to upgrade everything as suggested when I get a chance. Appreciate that the community is so active.