Open duxabilii opened 4 years ago
Hi @duxabilii. Thank you for your report. To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, please, review the Magento Contributor Assistant documentation.
@duxabilii do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
I have the same issue on Magento dev-2.4-develop
This is interesting. Per Magento DevDocs article Enable profiling (MAGE_PROFILER), the numeric options are still supported, but it has to be deprecated somehow. Basically, what is happening is that when this env variable is set to "2", the \Magento\Framework\ObjectManager\Profiler\Code\Generator\Logger
ultimately gets called to create a wrapper for each instance of a class that is instantiated by the ObjectManager, so that these classes may be profiled too.
Thing is, this generator class (again, which is used to generate the additional logger classes to be stored in generated\code
) isn't smart enough to deal with the new return types used in PHP 7. In your specific instance, the original class wants a return type of : string
, which the generated class does not have.
You can configure \Magento\Framework\ObjectManager\Profiler\Code\Generator\Logger::_getMethodInfo
to take the return type into account (because laminas/laminas-code
, which is used to generate the new logger class can generate classes with a return type), but this then in turn reveals a whole lot more that is broken.
I won't go into all the details, but the "invoke" method created by that generator class doesn't deal well with methods that return void, for instance, plus it also creates constructors that totally conflict with the classes they are overriding.
In short: this is completely broken, primarily because it's never been updated to deal with PHP 7 and their return types. I wish someone at Magento could indicate whether or not this is abandoned, or is just an oversight. Perhaps Blackfire is causing this to never be used and not be missed?
Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).Details
If the issue has a valid description, the label Issue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid
appears.
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description
label to the issue by yourself.
[ ] 3. Add Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.4-develop
branchDetails
- Add the comment @magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
[ ] 5. Add label Issue: Confirmed
once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
:white_check_mark: Confirmed by @engcom-Delta
Thank you for verifying the issue. Based on the provided information internal tickets MC-38977
were created
Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Preconditions (*)
Steps to reproduce (*)
SetEnv MAGE_PROFILER 2
Expected result (*)
Actual result (*)
Fatal error: Declaration of Magento\Framework\App\Request\PathInfo\Logger::getPathInfo(string $requestUri, string $baseUrl) must be compatible with Magento\Framework\App\Request\PathInfo::getPathInfo(string $requestUri, string $baseUrl): string in /var/www/generated/code/Magento/Framework/App/Request/PathInfo/Logger.php on line 0