-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
addRecord
method signature change causes Fatal Error
#1684
Comments
Commenting to note that this change also caused downstream issues in the Drupal monolog module: https://www.drupal.org/project/monolog/issues/3284825 |
Sorry for the problems here, I somehow didn't realize this was going to have an impact on downstream users. That said, extending Logger is probably not a great idea, and extending addRecord an even worse one IMO, so I think I may just leave this as is. The Drupal Monolog case is legit IMO and can probably be solved by #1686 - this would have been better as a feature request here than a hack. The Magento usage seems to be only used for tests (is that correct?) so unlikely to affect all magento users? Your PR works @convenient I guess but really I do wonder why Logger was extended here instead of adding a custom Handler to collect less-than-error records. That's what handlers are for, overriding addRecord for this is madness IMO. You could even do it with native handlers from monolog combining a FilterHandler and a TestHandler (or just the latter..) to gather records and access them again in the test. |
@Seldaek Agreed that this doesn't seem to be the correct way to do things in the Magento code, as I said I mainly flagged this in this repo so that it was at least recorded somewhere to be discussed 🙂 Apparently they also use that pattern in one of their optional modules magento/magento2#35604 This would prevent Magento from being deployable if you use monolog 2.7.0 but i think that its up to magento to fix their code and update composer.json restraints to ensure its always valid. |
Would you consider |
@dpi I marked it with Closing this as it seems the problems were mostly mitigated upstream. |
Raised in magento/magento2#35596 but thought i'd raise here just in case its something you want to be aware of. Happy for this issue to be closed if it just something that needs to be handled in magento but think it may help people if they have similar frameworks / similar issues.
This version of
monlog/monolog
was tagged about an hour ago https://github.com/Seldaek/monolog/releases/tag/2.7.0Which goes along with this commit
0ddba73#diff-1e7fd545cec457de96f5ed6bd7249ba091cd9e699b4057db15ff1e2e0364025bR297
This changes the method signature of
addRecord
like soIf you have PHP 8.1 class extending that class and method it will now get a PHP error like so (depending on what your class is called)
The text was updated successfully, but these errors were encountered: