Closed
Description
Preconditions (*)
- Magento 2.4.3-p1
- Debian GNU/Linux 9.13 (stretch)
PHP 7.4.24, 5.7.34
MySQL Community Server
Server version: Apache/2.4.25 (Debian)
Server built: 2021-10-02T13:27:55
Steps to reproduce (*)
- Magento Store Frontend: add an item to the cart
- Log in to a Magento customer account profile
- Go to Shopping Cart page as logged in customer
Expected result (*)
- I would see logged in user shopping cart with item in it
Actual result (*)
TypeError: htmlspecialchars() expects parameter 1 to be string, null given in /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/Escaper.php:417
Stack trace:
#0 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/Escaper.php(417): htmlspecialchars()
#1 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/woopra/analytics-m2/Block/Script.php(127): Magento\Framework\Escaper->escapeQuote()
#2 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/woopra/analytics-m2/view/frontend/templates/script.phtml(13): Woopra\Analytics\Block\Script->getSetting()
#3 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/TemplateEngine/Php.php(71): include('/var/www/html/d...')
#4 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Element/Template.php(273): Magento\Framework\View\TemplateEngine\Php->render()
#5 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Element/Template.php(303): Magento\Framework\View\Element\Template->fetchView()
#6 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(1114): Magento\Framework\View\Element\Template->_toHtml()
#7 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(1118): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}()
#8 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(678): Magento\Framework\View\Element\AbstractBlock->_loadCache()
#9 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Layout.php(578): Magento\Framework\View\Element\AbstractBlock->toHtml()
#10 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Layout.php(555): Magento\Framework\View\Layout->_renderBlock()
#11 /var/www/html/domains/dev.proproductssales.com/public_html/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#12 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#13 /var/www/html/domains/dev.proproductssales.com/public_html/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#14 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(529): Magento\Framework\View\Layout\Interceptor->renderElement()
#15 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/module-theme/view/frontend/templates/html/container.phtml(7): Magento\Framework\View\Element\AbstractBlock->getChildHtml()
#16 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/TemplateEngine/Php.php(71): include('/var/www/html/d...')
#17 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Element/Template.php(273): Magento\Framework\View\TemplateEngine\Php->render()
#18 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Element/Template.php(303): Magento\Framework\View\Element\Template->fetchView()
#19 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(1114): Magento\Framework\View\Element\Template->_toHtml()
#20 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(1118): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}()
#21 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(678): Magento\Framework\View\Element\AbstractBlock->_loadCache()
#22 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Result/Page.php(253): Magento\Framework\View\Element\AbstractBlock->toHtml()
#23 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/View/Result/Layout.php(171): Magento\Framework\View\Result\Page->render()
#24 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Result\Layout->renderResult()
#25 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Result\Page\Interceptor->___callParent()
#26 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}()
#27 /var/www/html/domains/dev.proproductssales.com/public_html/generated/code/Magento/Framework/View/Result/Page/Interceptor.php(95): Magento\Framework\View\Result\Page\Interceptor->___callPlugins()
#28 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/App/Http.php(120): Magento\Framework\View\Result\Page\Interceptor->renderResult()
#29 /var/www/html/domains/dev.proproductssales.com/public_html/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()
#30 /var/www/html/domains/dev.proproductssales.com/public_html/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
#31 /var/www/html/domains/dev.proproductssales.com/public_html/pub/index.php(29): Magento\Framework\App\Bootstrap->run()
#32 {main}
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- [x ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Looked at the function including line 417 in Escaper.php
public function escapeQuote($data, $addSlashes = false)
{
if ($addSlashes === true) {
$data = addslashes($data);
}
return htmlspecialchars($data, $this->htmlSpecialCharsFlag, null, false);
}
Temporary fix:
Created a module that overrides this function with this one:
public function escapeQuote($data, $addSlashes = false)
{
if ($addSlashes === true) {
$data = addslashes($data);
}
if (!empty($data)) {
return htmlspecialchars($data, $this->htmlSpecialCharsFlag, null, false);
} else {
return $data;
}
}
Now it is working but I think that this is a bug possibly (why would there be an error if data is empty?)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done