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

Uncaught Error: Failed opening required 'phar:///usr/local/bin/phplint/config/bootstrap.php' #203

Closed
nvuillam opened this issue Feb 5, 2024 · 6 comments
Assignees
Labels

Comments

@nvuillam
Copy link

nvuillam commented Feb 5, 2024

New Issue

Diagnose

If you use PHAR version of PHP Lint, please specify:

Installed with phive: phive --no-progress install overtrue/phplint --force-accept-unsigned -g

Installation log from MegaLinter Dockerfile process:

#13 [stage-0  5/18] RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install overtrue/phplint --force-accept-unsigned -g
#13 0.075 Phive 0.15.2 - Copyright (C) 2015-2024 by Arne Blankerts, Sebastian Heuer and Contributors
#13 0.291 Downloading https://api.github.com/rate_limit
#13 0.894 Downloading https://api.github.com/repos/overtrue/phplint/releases?per_page=100
#13 1.523 Downloading https://github.com/overtrue/phplint/releases/download/9.1.1/phplint.phar
#13 1.538 Copying phplint-9.1.1.phar to /usr/local/bin/phplint
#13 1.540 
#13 DONE 1.6s

Summary

Fatal error while calling any phplint command

Expected behaviour

No fatal error

Actual behaviour

Example 1 with phplint -h

DEBUG    root:Linter.py:1129 Linter help command: ['phplint', '-h']
DEBUG    root:Linter.py:1144 Linter help result: 255 PHP Warning:  require_once(phar:///usr/local/bin/phplint/config/bootstrap.php): Failed to open stream: phar error: "config/bootstrap.php" is not a file in phar "/usr/local/bin/phplint" in phar:///usr/local/bin/phplint/bin/phplint on line 7
PHP Fatal error:  Uncaught Error: Failed opening required 'phar:///usr/local/bin/phplint/config/bootstrap.php' (include_path='.:/usr/share/php81') in phar:///usr/local/bin/phplint/bin/phplint:7

Example 2

[phplint] command: ['phplint', '-c', '/action/lib/.automation/.phplint.yml', 'php_good_1.php', 'php_good_2.php']
[phplint] CWD: /tmp/lint/.automation/test/php
[phplint] result: 255 PHP Warning:  require_once(phar:///usr/local/bin/phplint/config/bootstrap.php): Failed to open stream: phar error: "config/bootstrap.php" is not a file in phar "/usr/local/bin/phplint" in phar:///usr/local/bin/phplint/bin/phplint on line 7
PHP Fatal error:  Uncaught Error: Failed opening required 'phar:///usr/local/bin/phplint/config/bootstrap.php' (include_path='.:/usr/share/php81') in phar:///usr/local/bin/phplint/bin/phplint:7
Stack trace:
#0 /usr/local/bin/phplint(18): require()
#1 {main}
  thrown in phar:///usr/local/bin/phplint/bin/phplint on line 7

Full job logs is available here: https://github.com/oxsecurity/megalinter/actions/runs/7789108227/job/21240023175?pr=3341

@llaville llaville self-assigned this Feb 6, 2024
@llaville llaville added the bug label Feb 6, 2024
@llaville
Copy link
Collaborator

llaville commented Feb 6, 2024

This issue affect only PHAR version 9.1.1 and not 9.0.8 !
Will checks it.

@llaville
Copy link
Collaborator

llaville commented Feb 6, 2024

While contents of BOX config file v9.1 is almost the same as v9.0 (except compression directive)

We use BOX v6 to build PHAR version of v9.1, while we use BOX v5 to build PHAR version of v9.0

@llaville
Copy link
Collaborator

llaville commented Feb 6, 2024

Even if I try to follow the SOLID design principle, and especially the single responsability principle
by splitting the autoloader in its own file config/bootstrap.php, we've got another issue when trying to build the PHAR version 9.1.1 with BOX project v5 or v6.

Even if I found new issues with BOX v6 that was not present with BOX v5, it's not the fault of BOX project here.

When you don't specify files or directories directives into box.json config file, the Auto-discover feature is enabled.
But BOX is not able to detect a file included inside another like that => https://github.com/overtrue/phplint/blob/9.1.1/bin/phplint#L6

So the solution to fix this problem is to use force-autodiscovery directive.

PS: @nvuillam Thanks for reporting, a new version 9.1.2 will be soon available !

@nvuillam
Copy link
Author

nvuillam commented Feb 6, 2024

@llaville you're welcome. for once i'm useful to one of your repos, and not the contrary 😅

Meanwhile i downgraded phplint in MegaLinter and it's ok ^^

@llaville
Copy link
Collaborator

llaville commented Feb 6, 2024

Version 9.1.2 is available

@llaville llaville closed this as completed Feb 6, 2024
@nvuillam
Copy link
Author

nvuillam commented Feb 6, 2024

Thanks for your reactivity :)

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

No branches or pull requests

2 participants