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

PHAR 3.3.0 has \r char that breaks tool under Linux #281

Closed
Slamdunk opened this issue Jul 12, 2021 · 8 comments · Fixed by #310
Closed

PHAR 3.3.0 has \r char that breaks tool under Linux #281

Slamdunk opened this issue Jul 12, 2021 · 8 comments · Fixed by #310
Assignees
Labels
Milestone

Comments

@Slamdunk
Copy link

See shivammathur/setup-php#473 (comment)

$ wget "https://github.com/maglnet/ComposerRequireChecker/releases/download/3.3.0/composer-require-checker.phar"
[...]
2021-07-12 11:17:18 (1.38 MB/s) - ‘composer-require-checker.phar’ saved [634200/634200]
$ chmod +x composer-require-checker.phar
$ ./composer-require-checker.phar
/usr/bin/env: ‘php\r’: No such file or directory
@Slamdunk
Copy link
Author

Likely related to

<php expression="file_put_contents('bin/clistub.php', '#!/usr/bin/env php' . PHP_EOL . Phar::createDefaultStub('bin/composer-require-checker.php'))"/>

@loevgaard
Copy link

Obviously I don't know what people use for setting up their CI, but I use GitHub Actions and https://github.com/shivammathur/setup-php for setting up PHP. I have fixed this temporarily with this setup-php config:

dependency-analysis:
    name: "Dependency Analysis"

    runs-on: "ubuntu-latest"

    strategy:
        matrix:
            php-version:
                - "7.4"
                - "8.0"

            dependencies:
                - "highest"

    steps:
        -   name: "Checkout"
            uses: "actions/checkout@v2"

        -   name: "Setup PHP, with composer and extensions"
            uses: "shivammathur/setup-php@v2"
            with:
                coverage: "none"
                extensions: "${{ env.PHP_EXTENSIONS }}"
                php-version: "${{ matrix.php-version }}"
                tools: "composer-require-checker:3.1.0, composer-unused" # todo using 3.1.0 until this issue is fixed: https://github.com/maglnet/ComposerRequireChecker/issues/281

Notice the composer-require-checker:3.1.0 in the tools key.

@Ocramius
Copy link
Collaborator

As per #256, my recommendation on how to install the tool:

mkdir -p tools/composer-require-checker
cd tools/composer-require-checker
echo "{}" > composer.json
composer require maglnet/composer-require-checker
cd -
tools/composer-require-checker/vendor/bin/composer-require-checker

Committing a composer.lock inside tools/composer-require-checker is endorsed :)

@loevgaard
Copy link

I see your point, @Ocramius. Thanks :)

@Slamdunk
Copy link
Author

@loevgaard
Copy link

loevgaard commented Jul 15, 2021

Guess we all love Shivam ❤️

mfn added a commit to mfn/ComposerRequireChecker that referenced this issue Nov 8, 2021
When being built under systems having different PHP_EOL than \r,
a phar will be built not working _usually_ under unix-alike system.

Fixes maglnet#281
@mfn
Copy link
Contributor

mfn commented Nov 8, 2021

I understand the desire the remove phar building completely, bad it's damn convenient TBH.

And, maybe I'm wring, we just need to use a \n instead of PHP_EOL I thought I make a PR -> #310

I tested this locally and it just worked (though I'm on non-windows systems anyway 😬)

@Ocramius Ocramius added this to the 3.3.1 milestone Nov 8, 2021
@Ocramius Ocramius added the bug label Nov 8, 2021
@Ocramius Ocramius self-assigned this Nov 8, 2021
@Ocramius
Copy link
Collaborator

Ocramius commented Nov 8, 2021

Handled in #310

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants