astorm / pestle

A collection of command line scripts for Magento 2 code generation, and a PHP module system for organizing command line scripts.
MIT License
533 stars 101 forks source link

Parse error on every commands #510

Closed melBoh closed 4 years ago

melBoh commented 4 years ago

Hi, long time user of Pestle, I installed it on a new project and sadly can't use it :(

php pestle.phar list-commands
PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in phar:///var/www/html/project/pestle.phar/vendor/zendframework/zend-diactoros/src/functions/marshal_uri_from_sapi.php on line 83

Here is the result of php -v

php -v
PHP 7.0.33-0+deb9u6 (cli) (built: Oct 24 2019 18:50:20) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.33-0+deb9u6, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans

I'm on Debian 9 Tried a fresh install on a Mac too, same result. Can you help me ? Thank you

astorm commented 4 years ago

@melBoh Interesting -- can you send a php -v from your Mac as well. My first guess would be some PHP syntax that doesn't work in 7.0 slipped in there -- knowing what version of PHP you're running on your mac would help.

astorm commented 4 years ago

@melBoh Confirmed that the problem is PHP 7.0 related. The file

vendor/zendframework/zend-diactoros/src/functions/marshal_uri_from_sapi.php

isn't used by pestle, but it's a dependency of a dependency that gets bundled in automatically. It has some syntax that's not PHP 7.0 compatible.

Question -- can you upgrade to PHP 7.1, or is the deprecated PHP 7.0 a hard requirement for you?

astorm commented 4 years ago

So this one is a tricky situation -- PHP 7.0 has reach end of life. It's not supported by the people who make PHP anymore, which means it's increasingly hard to target both it, and more recent version of PHP in the same project.

We've merged a PR that removes this file from pestle's build, and everything seems to be working as expected.

https://github.com/astorm/pestle/pull/514

We're encourage you to find a way to get off that old version of PHP. We'll endeavour to keep pestle running there, but can't make any promises as to whether we'll be able to do it.

The above PR should go out in the 1.5.1 release of pestle.