-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
PHP Compactor removes attributes when Phar is being generated on PHP < 8.0 #567
Comments
This was referenced Oct 10, 2021
I've opened PR #568 to address this issue. |
jrfnl
added a commit
to jrfnl/PHP-Parallel-Lint
that referenced
this issue
Oct 10, 2021
For the time being, until box-project/box#567 has been fixed: 1. Disable the addition of the requirement checker from Box as the version included in the last release of Box is not compatible with PHP 8.1. 2. Change the PHP version used to generate the Phar to PHP 8.0 to get round the problem the PHP compactor has with attributes. Note: the generated Phar file should still be compatible with all supported PHP versions.
jrfnl
added a commit
to jrfnl/PHP-Parallel-Lint
that referenced
this issue
Oct 11, 2021
For the time being, until box-project/box#567 has been fixed: 1. Disable the addition of the requirement checker from Box as the version included in the last release of Box is not compatible with PHP 8.1. 2. Change the PHP version used to generate the Phar to PHP 8.0 to get round the problem the PHP compactor has with attributes. Note: the generated Phar file should still be compatible with all supported PHP versions.
jrfnl
added a commit
to jrfnl/PHP-Parallel-Lint
that referenced
this issue
Oct 11, 2021
For the time being, until box-project/box#567 has been fixed: 1. Disable the addition of the requirement checker from Box as the version included in the last release of Box is not compatible with PHP 8.1. 2. Change the PHP version used to generate the Phar to PHP 8.0 to get round the problem the PHP compactor has with attributes. Note: the generated Phar file should still be compatible with all supported PHP versions.
jrfnl
added a commit
to jrfnl/PHP-Parallel-Lint
that referenced
this issue
Oct 11, 2021
For the time being, until box-project/box#567 has been fixed: 1. Disable the addition of the requirement checker from Box as the version included in the last release of Box is not compatible with PHP 8.1. 2. Change the PHP version used to generate the Phar to PHP 8.0 to get round the problem the PHP compactor has with attributes. Note: the generated Phar file should still be compatible with all supported PHP versions.
jrfnl
added a commit
to jrfnl/PHP-Parallel-Lint
that referenced
this issue
Oct 11, 2021
For the time being, until box-project/box#567 has been fixed: 1. Disable the addition of the requirement checker from Box as the version included in the last release of Box is not compatible with PHP 8.1. 2. Change the PHP version used to generate the Phar to PHP 8.0 to get round the problem the PHP compactor has with attributes. Note: the generated Phar file should still be compatible with all supported PHP versions.
jrfnl
added a commit
to jrfnl/PHP-Parallel-Lint
that referenced
this issue
Oct 11, 2021
For the time being, until box-project/box#567 has been fixed: 1. Disable the addition of the requirement checker from Box as the version included in the last release of Box is not compatible with PHP 8.1. 2. Change the PHP version used to generate the Phar to PHP 8.0 to get round the problem the PHP compactor has with attributes. Note: the generated Phar file should still be compatible with all supported PHP versions.
This was referenced Oct 11, 2021
Closed
jrfnl
added a commit
to jrfnl/PHP-Parallel-Lint
that referenced
this issue
Dec 1, 2021
For the time being, until box-project/box#567 has been fixed: 1. Disable the addition of the requirement checker from Box as the version included in the last release of Box is not compatible with PHP 8.1. 2. Change the PHP version used to generate the Phar to PHP 8.0 to get round the problem the PHP compactor has with attributes. Note: the generated Phar file should still be compatible with all supported PHP versions.
grogy
pushed a commit
to php-parallel-lint/PHP-Parallel-Lint
that referenced
this issue
Dec 1, 2021
For the time being, until box-project/box#567 has been fixed: 1. Disable the addition of the requirement checker from Box as the version included in the last release of Box is not compatible with PHP 8.1. 2. Change the PHP version used to generate the Phar to PHP 8.0 to get round the problem the PHP compactor has with attributes. Note: the generated Phar file should still be compatible with all supported PHP versions.
@theofidry Any idea when a new version of Box will be tagged including this fix ? |
Thanks @theofidry ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Context
Attributes were introduced in PHP 8.0, but few projects (so far) were using them.
However, PHP 8.1 has added type declarations to all PHP native interfaces and classes.
For userland code implementing these interfaces or extending the classes, this means that they:
mixed
is PHP 8.0,void
is PHP 7.1 etc), an attribute can be added to silence the deprecation warning which would otherwise be thrown in PHP 8.1 and higher.In effect, this means that a lot more projects will now suddenly start using attributes.
Example:
The Problem
The PHP Compactor -
KevinGH\Box\Compactor\Php
-, which is included with Box, does not account for PHP 8.0+ attributes.In PHP < 8.0, attributes are tokenized as comments and the compactor blindly removes those, while for Phar files which need to be compatible with PHP 8.1, those attributes need to stay in the code to prevent the deprecation notices.
Solution
The PHP Compactor needs to be made compatible with PHP 8.0 in regards to attributes.
Stop-gap solution until a release has been tagged containing a proper solution
For the time being, projects which need to generate Phar files which are compatible with PHP 8.1 will need to:
"check-requirements": false
to theirbox.json
configuration to prevent the notices coming from Box itself showing.Those notices were already fixed in PHP 8.1: fix two deprecation warnings #557, but a) that fix has not been included in a tagged release yet and b) even if it were, the
box.json.dist
config for Box itself includes the PHP compactor and with the Phar being generated on PHP 7.3, the attributes would be stripped from the generated Box Phar file.Or if the Phar generation is done on PHP < 8.0, the PHP compactor needs to be turned off/removed for the time being until the compactor code in Box has been fixed.
Loosely related to #557 as the attributes introduced in that PR will ALSO be removed if a Phar is generated (including for Box itself) on PHP < 8.0.
The text was updated successfully, but these errors were encountered: