cocur / slugify

Converts a string to a slug. Includes integrations for Symfony, Silex, Laravel, Zend Framework 2, Twig, Nette and Latte.
MIT License
2.89k stars 252 forks source link

version 4.5.0 is not compatible with PHP 7 although mentioned in packagist #332

Open eastern-ravindra opened 1 year ago

eastern-ravindra commented 1 year ago

I have installed version 4.5.0 for my PHP7 compatible application. But it is giving below error

ParseError: syntax error, unexpected '|', expecting variable (T_VARIABLE)

/home/scrutinizer/build/vendor/cocur/slugify/src/Slugify.php:100

https://github.com/cocur/slugify/blame/af8e6ee771458bf885f7457807b5ff9bad8743cb/src/Slugify.php#L100

From error we can see that it is not compatible with PHP 7 but what mentioned in packagist https://packagist.com/orgs/acsi-it/packages/419786/versions/4.5.0.0/view it is contradictory

atierant commented 1 year ago

Idem with PHP 7.1 with tag 4.5.0 :

syntax error, unexpected 'array' (T_ARRAY), expecting function (T_FUNCTION) or const (T_CONST) in /var/www/html/vendor/cocur/slugify/src/Slugify.php:34

protected array $rules = [];

I had to write in my composer.json "cocur/slugify": "~4.4.0", to downgrade to 4.4.0 and fix it

bobdenotter commented 1 year ago

For people affected by this, a better workaround is adding this to your composer.json:

    "conflict": {
        "cocur/slugify": "4.5.0"
    },

Doing so, will allow your project to fetch later versions, once you get around to bumping it to PHP 8.x.

razvanalin commented 9 months ago

Please, if we can update this post when its fixed we can remove conflict configuration.