-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
Fix Deprecated Functionality Error Caused by Passing NULL to nl2br() in Sharing Template #3779
Conversation
app/design/frontend/rwd/default/template/catalog/product/view/sharing.phtml
Show resolved
Hide resolved
I think that the change should not strictly target that line in the template file, but it should be analyzed to solve in one place all similar situations related to usage of nl2br through templates. If an attribute used in the template is null, the error could appear, it is not a problem related only to the short_description attribute. |
I'm merging this although @kiatng's review got invalidated by my last commit, but I just had to fix a conflict on the README file. |
Description (*)
Prevents an error caused by passing null to nl2br() in the rwd default catalog product view sharing template if the product short description is not set.
It is possible for the short description product attribute to be empty if a site is upgraded from legacy Magento and/or the attribute setting is changed to Values Required "No".
If the product short description isn't set, the sharing template passes null to nl2br(), resulting in "ERR (3): Deprecated functionality: nl2br(): Passing null to parameter #1 ($string) of type string is deprecated in [docroot]/app/design/frontend/rwd/default/template/catalog/product/view/sharing.phtml on line 30".
This change makes sure even if the product short description is null, we at least pass an empty string to nl2br().
Related Pull Requests
n/a
Fixed Issues (if relevant)
n/a
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)