Project

General

Profile

Actions

Bug #95528

closed

PHP parse error in PackageArtifactBuilder

Added by Gerhard Weise over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Miscellaneous
Target version:
-
Start date:
2021-10-07
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

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


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #96017: Relax PackageArtifactBuilder to support PHP 7.1ClosedSimon Gilli2021-11-17

Actions
Actions #1

Updated by Georg Ringer over 2 years ago

  • Status changed from New to Needs Feedback

are you really using PHP 7.4?

Actions #2

Updated by Benni Mack over 2 years ago

This usually happens if the server (CI build server) runs a different PHP version or composer version than the production system, is that possible?

Actions #3

Updated by Oliver Hader over 2 years ago

  • 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.

Actions #4

Updated by Benni Mack over 2 years ago

  • Status changed from Needs Feedback to Closed
Actions #5

Updated by Sebastian Schmal over 2 years ago

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

Actions #6

Updated by Roley McGallagher over 2 years ago

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.

Actions #7

Updated by Sebastian Schmal over 2 years ago

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.
Actions #9

Updated by Jörg Velletti over 2 years ago

Same error on a shared hoster: (df.eu)
php --version -> 7.4.1..
composer --version -> 2.1.14 ..

but still composer is loading from "somewhere" php 7.3

Final solution from this gist https://gist.github.com/peterkraume/95b6ea3620cad311865e69a686564fc7

  ln -s /usr/bin/php74 ~/php

and add to:

.bashrc

  export PATH=$HOME:$PATH

Actions #10

Updated by Christian Kuhn over 2 years ago

  • Related to Task #96017: Relax PackageArtifactBuilder to support PHP 7.1 added
Actions #11

Updated by Christian Kuhn over 2 years ago

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.

Actions

Also available in: Atom PDF