Bug #95528
closed
PHP parse error in PackageArtifactBuilder
Added by Gerhard Weise over 2 years ago.
Updated over 2 years ago.
Description
While updating to Version 11.5 an error is thrown
PHP Parse error: syntax error, unexpected 'Event' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in PackageArtifactBuilder.php on line 49
This error also appears with a new installation
- Status changed from New to Needs Feedback
are you really using PHP 7.4?
This usually happens if the server (CI build server) runs a different PHP version or composer version than the production system, is that possible?
- Subject changed from Update to TYPO3 v11.5 to PHP parse error in PackageArtifactBuilder
Line 49 of PackageArtifactBuilder.php
has the following
private Event $event;
Thus, Benni's assumption seems to be correct - the application is used with a PHP version lower than PHP 7.4.
- Status changed from Needs Feedback to Closed
same Error here after "composer update"
Error:
PHP Parse error: syntax error, unexpected 'Event' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /public/typo3/sysext/core/Classes/Composer/PackageArtifactBuilder.php on line 49
Parse error: syntax error, unexpected 'Event' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /public/typo3/sysext/core/Classes/Composer/PackageArtifactBuilder.php on line 49
PHP: PHP Version 7.4.23
I get this error if I use PHP8.0
PHP Parse error: syntax error, unexpected 'Event' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in \app\public\typo3\sysext\core\Classes\Composer\PackageArtifactBuilder.php on line 49
Parse error: syntax error, unexpected 'Event' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in \app\public\typo3\sysext\core\Classes\Composer\PackageArtifactBuilder.php on line 49
On PHP7.4 everything is fine.
same error here after "composer update":
PHP Parse error: syntax error, unexpected 'Event' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /public/typo3/sysext/core/Classes/Composer/PackageArtifactBuilder.php on line 49
Parse error: syntax error, unexpected 'Event' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /public/typo3/sysext/core/Classes/Composer/PackageArtifactBuilder.php on line 49
$php74 --version
PHP 7.4.26 (cli) (built: Nov 19 2021 11:52:45) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with the ionCube PHP Loader + ionCube24 v10.4.0, Copyright (c) 2002-2020, by ionCube Ltd.
- Related to Task #96017: Relax PackageArtifactBuilder to support PHP 7.1 added
Hey.
All reports probably come from instances where the php version in web context is 7.4 or higher, but on cli it's still < 7.4. It is unfortunate some hosters don't get this right, and there are probably various workaround for specific ones.
In this case, we relaxed this file a bit to also deal with older PHP versions, this is class executed early and "hooked" into composer does not fail when the PHP version is too old. See #96017 for details.
Also available in: Atom
PDF