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

fatal error on php 7.4.x - PHP expects '{' but got '|'... it works on php 8.x #194

Closed
apazureck opened this issue Mar 15, 2023 · 3 comments
Labels

Comments

@apazureck
Copy link

apazureck commented Mar 15, 2023

Hi,

I am using your liquid parser in a wordpress plugin. I developed that plugin unsing the latest docker image of wordpress, which uses php 8.

When I tried to deploy it on our production wordpress, which still uses php 7.4 and I got a syntax error in

liquid/vendor/thecodingmachine/safe/lib/special_cases.php:434

I fixed it like this:

// special_cases.php
- function fgetcsv($stream, int $length = null, string $separator = ",", string $enclosure = "\"", string $escape = "\\"): array|false
+ function fgetcsv($stream, int $length = null, string $separator = ",", string $enclosure = "\"", string $escape = "\\")

It seems php 7.4 does not know the pipe symbol. Version 8 does know that.

I am not a php programmer, so I don't know what the best fix for that is. I just deleted the type definition of the function and it works now on my wordpress using php 7.

Composer says the package is compatible with php 7.3+, so I just wanted to let you know.

@sanmai
Copy link
Collaborator

sanmai commented Mar 15, 2023

As you can see, this isn't an issue with this package but rather with thecodingmachine/safe.

@sanmai sanmai closed this as completed Mar 15, 2023
@sanmai sanmai added the invalid label Mar 15, 2023
@apazureck
Copy link
Author

OK, but it comes with your package.

@sanmai
Copy link
Collaborator

sanmai commented Mar 15, 2023

It is not. You are responsible for files in vendor. You can see they are nowhere in this repository. There's nothing I can do.

https://github.com/kalimatas/php-liquid/tree/master/vendor

Repository owner locked and limited conversation to collaborators Mar 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants