Skip to content
This repository has been archived by the owner on Sep 6, 2020. It is now read-only.

Phar file for v2.7.4 is broken [unexpected T_STRING in Process.php] #151

Closed
keradus opened this issue Aug 16, 2016 · 13 comments
Closed

Phar file for v2.7.4 is broken [unexpected T_STRING in Process.php] #151

keradus opened this issue Aug 16, 2016 · 13 comments
Assignees
Labels

Comments

@keradus
Copy link
Contributor

keradus commented Aug 16, 2016

Box project claims to work under PHP 5.3.3

This is not true anymore for v2.7.4 phar file, v2.7.2 phar file is working.
Failing example: https://travis-ci.org/FriendsOfPHP/PHP-CS-Fixer/jobs/152603392#L963

The reason is the way that box phar file was built - it uses too new deps, exactly Symfony v3.x components (in general it allows v2 || v3), which won't run under PHP 5.3.3. I would say that build is done on newer PHP version. It could be avoided by updating component deps before building the box phar with "platform": {"php": "5.3.3"} in composer.json file (example).

Sadly, I cannot help more as phar file is built outside Travis (probably locally by project maintainers).

keradus added a commit to PHP-CS-Fixer/PHP-CS-Fixer that referenced this issue Aug 16, 2016
…o longer working on 5.3 (keradus)

This PR was merged into the 1.11 branch.

Discussion
----------

Move phar building to PHP 5.6 job as newest box.phar is no longer working on 5.3

Closes #2134

Build with enforced phar building: https://travis-ci.org/FriendsOfPHP/PHP-CS-Fixer/builds/152762585

As expected (see box-project/box2#151):
* 5.3 is not working: https://travis-ci.org/FriendsOfPHP/PHP-CS-Fixer/jobs/152762586#L988
* 5.6 is working: https://travis-ci.org/FriendsOfPHP/PHP-CS-Fixer/jobs/152762604#L848

Commits
-------

07059f9 Move phar building to PHP 5.6 job as newest box.phar is no longer working on 5.3
@weitzman
Copy link

Also broken on PHP 5.4 AFAICT - https://travis-ci.org/drush-ops/drush/jobs/162482903

@glensc
Copy link

glensc commented Dec 10, 2016

corrected .travis.yml link: https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v1.11.8/.travis.yml#L48-L52

(never use links to source code lines using branch, use tag or git commit)

@keradus
Copy link
Contributor Author

keradus commented Dec 10, 2016

is this project not maintained ?

@kherge kherge self-assigned this Dec 11, 2016
@kherge kherge added the Bug label Dec 11, 2016
@kherge
Copy link
Contributor

kherge commented Dec 11, 2016

box-2.7.4-3-g8ce371c.phar.zip

Can you guys please give this build a try?

I took the suggestion of applying the platform config setting and re-installed all of the vendor packages after resetting the lock file, hopefully it works on 5.3 now. If it does, I'll tag a new release and upload a new archive for download.

@glensc
Copy link

glensc commented Dec 11, 2016

@kherge try how? where's the .phar to test with?

@kherge
Copy link
Contributor

kherge commented Dec 11, 2016

@glensc Ack, I messed up my last post. I fixed it now, the link should be at the top of my previous post.

@glensc
Copy link

glensc commented Dec 12, 2016

i can confirm the phar works

$ php53 -d phar.readonly=0 box-2.7.4-3-g8ce371c.phar build -c ~/scm/eventum/cli/box.json 
Building...

$ php53 -d phar.readonly=0 box-2.7.4.phar build -c ~/scm/eventum/cli/box.json 
Building...
PHP Parse error:  syntax error, unexpected T_STRING in phar:///home/glen/Downloads/box-2.7.4.phar/src/vendors/symfony/process/Process.php on line 538
PHP Stack trace:

@glensc
Copy link

glensc commented Dec 12, 2016

but, why not build the .phar from travis?

you can build the .phar from travis and upload it automatically to github release when tag is made:

encrypted string is probably securer because it does not "leak" from build logs because it's already public (committed to repository). secure variable may leak if you print out env variables in your build. travis-ci implentation is weird, they should replace secure variables with *** but it doesn't (always?) work.

@keradus
Copy link
Contributor Author

keradus commented Dec 12, 2016

phar file is signed here (at least it was once), not easy to manage private gpg key on travis

@kherge
Copy link
Contributor

kherge commented Dec 12, 2016

Thank you @glensc!

@keradus Could you also confirm that it works for you?

@glensc
Copy link

glensc commented Dec 12, 2016

@kherge you can sign it offline (downloading copy) after you have verified contents. i do that practice myself.

@keradus
Copy link
Contributor Author

keradus commented Dec 12, 2016

D:\tmp
λ php --version
PHP 5.3.29 (cli) (built: Aug 15 2014 19:17:16)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies

D:\tmp
λ php box-2.7.4-3-g8ce371c.phar --version
Box version 2.7.4-3-g8ce371c build 8ce371cdc1f0005e087e9ca5c265b52b5f560fd4

Thank you @kherge
I hope new versions will be safe from that bug ;)
I'm closing a ticket.


@glensc personally i see making an artifact by travis, upload it to gh by travis, then download it, sign it and reuplaod it a little workaround... not needed

@keradus keradus closed this as completed Dec 12, 2016
@glensc
Copy link

glensc commented Dec 12, 2016

@keradus letting travis make the phar, i see:

  1. consistent results, developer may change their default php version and hence this issue
  2. making release is easy than just git tag & push

why you need to re-upload? the signature is detached.

also you need actually invoke box build, --version did not trigger this bug.

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

4 participants