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
Fatal error on product-compare page when attributes not configured #20229
Comments
Hi @Brengineer. 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:
where @Brengineer do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
Hi @irajneeshgupta. Thank you for working on this issue.
|
@irajneeshgupta Thank you for verifying the issue. Based on the provided information internal tickets |
Hi @saphaljha. Thank you for working on this issue.
|
I have a project on 2.3.0 that is experiencing the same issue. We've reported the issue to Magento Partner Support and I'll be working with our developer team later this evening to implement the fix committed in the updated list.phtml file and verify if it resolves our reported issue as well. |
Hi @Brengineer. Thank you for your report. The fix will be available with the upcoming 2.3.1 release. |
…ibutes not configured #20231
[Backport] Fix magento#20229-Fatal error on product-compare page when attributes not configured
@magento-engcom-team give me 2.3.0 instance |
Hi @0-Sony. Thank you for your request. I'm working on Magento 2.3.0 instance for you |
Hi @0-Sony, here is your Magento instance. |
the bug still not fixed in 2.3 |
2.3.0 or 2.3.1? The fix should be available in 2.3.1 |
Adding the is_string check in For example, in the case of boolean attributes, |
Yes, I agree. I did not like the given fix either. This is why I suggested in the first place to "cast the result... as a string". It is quite simple, and this way it is always rendered, but it will not cause any errors:
Of course, to make the code a little cleaner, you could first set a variable:
|
Hello, If you add 1 or more products in the Compare List, and these Products have no Short Description or Description, then when you visit the Compare page you get the following Fatal Error:
Update: |
it is mg 2.3.5 p1 but I am still facing this issue |
/var/www/magento/vendor/magento/module-catalog/Helper/Output.php is failing because when the description isn't present, it's a Phrase Object and not a string. Casting to (string) fixes it. Magento\Framework\Phrase Object Here's my patchfile for 2.3.5-p1 Looking at the current source I do see this is fixed in latest versions, and #28254 referenced above also indicates this. P.S. (Not sure how I unassigned @irajneeshgupta , sorry about that if it's an issue) |
Preconditions
Steps to reproduce
Expected result
Actual result
The error occurs in the
isDirectivesExists()
method, which expects a string param. This method is called byproductAttribute()
, which passes$attributeHtml
, which it receives as a param that is also expected to be a string.The issue is that in
app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml:119
, whereproductAttribute()
is called, the 2nd param passed is a value from\Magento\Catalog\Block\Product\Compare\ListCompare::getProductAttributeValue
, which returns a\Magento\Framework\Phrase
object when the value of an attribute is undefined. Therefore, an error is thrown when this object is passed through topreg_match()
.The issue was triggered in commit #bdcfbc8, where a call to
isDirectivesExists()
is added to line 167 ofapp/code/Magento/Catalog/Helper/Output.php
. However, this is reasonable, since a string is expected. Therefore I recommend simply modifying line 119 oflist.phtml
to cast the result ofgetProductAttributeValue()
as a string, which would be appropriate, since that's whatproductAttribute()
is expecting.The text was updated successfully, but these errors were encountered: