mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 08:05:53 +03:00
[GH-ISSUE #1651] Monolog version 2.4.0 incompatible with PHP versions <8 #706
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#706
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @michdingpayc on GitHub (Apr 7, 2022).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1651
The file src/Monolog/Attribute/AsMonologProcessor.php in monolog version 2.4.0 uses constructor property promotion (lines 31-33) which was introduced in PHP version 8.0.
When used in PHP 7.4, one sees the following:
PHP Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting variable (T_VARIABLE) in [...]/vendor/monolog/monolog/src/Monolog/Attribute/AsMonologProcessor.php on line 31.The issue here is the fact that the composer.json file and therefore the monolog/monlog packagist page lists the PHP version requirement as
">=7.2".@Seldaek commented on GitHub (Apr 7, 2022):
Attributes are a php8 feature so you cannot use this class on 7.4 anyway and I'm not sure what you are doing?
@wp-seopress commented on GitHub (Apr 8, 2022):
Same issue here, VS Code returns an error.
Solution?
public function __construct(?string $channel = null, ?string $handler = null, ?string $method = null) {@michdingpayc commented on GitHub (Apr 8, 2022):
Thank you for the quick response.
The attribute class isn't used in the PHP 7.4 project I'm referencing, but the monolog vendor directory is preloaded into opcache. This is done for performance purposes but with monolog version 2.4.0 that is also where this issue arises.
The file can be explicitly excluded from preloading, but I would like to hear your thoughts first.
@Seldaek commented on GitHub (Apr 8, 2022):
Fixed in
github.com/Seldaek/monolog@508df120fa- please upgrade to 2.5.0@michdingpayc commented on GitHub (Apr 8, 2022):
Thank you kindly!