-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Missing variable outside CATCH causing a double-fault in Renderer.php #27009
Comments
Hi @HeiderSati. Thank you for your report.
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:
For more details, please, review the Magento Contributor Assistant documentation. @HeiderSati do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
I confirm all the above, can't tick any of the confirmation-boxes, not sure why (using Safari on MacBook)!?.. anyway, hopefully my bug-report with it's fix helps improving your product. Thanks |
Hi @vincent-le89. Thank you for working on this issue.
|
Hi Vincent, Thank you for picking this up. I read your comments, all you need is already in the ticket (the problem, the code-part, the exact line in the code, and how to fix). This should be really easy for you, Again, the catch() function you have there is trying to display $template variable when it's not already defined, causing a different error (double-fault), you need to instance it (i.e. add -----> $template="") before the try() block so that it's catch() would work and return the real error, |
@HeiderSati I believe that it will be released on version 2.4. Thanks |
Hi @HeiderSati. Thank you for your report. The fix will be available with the upcoming 2.4.0 release. |
OK
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
getting an error in: vendor/magento/framework/View/Page/Config/Renderer.php file with missing variable of $template.
The issue is to do with the following code (line 429) on the above file, I attach the function below:
protected function renderAssetHtml(\Magento\Framework\View\Asset\PropertyGroup $group)
{
$assets = $this->processMerge($group->getAll(), $group);
$attributes = $this->getGroupAttributes($group);
}
The issue is that in this code, there is an exception occurring (which is fine/expected), however, inside the catch notice that there is a $template variable being referenced and PHP is throwing the error saying $template does not exists.
This is because $template only exists inside the foreach {} block and would not be accessible from the catch {} block, this causes Magento to render a blank page or come out with an error inside the catch which is a double-fault.
The solution is to add just before the try {} block the following:
this should fix the issue, I already fixed it on mine and now Magento-2 is working better.
I hope this helps.
Regards
Heider
The text was updated successfully, but these errors were encountered: