Skip to content
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

Latest laminas/laminas-escaper (2.7.0 -> 2.7.1) breaks product and catalog category view pages #33346

Closed
1 task
msyhr opened this issue Jun 24, 2021 · 26 comments · Fixed by #33353
Closed
1 task
Assignees
Labels
Component: Framework/Escaper Component: Framework/Url Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P0 This generally occurs in cases when the entire functionality is blocked. Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.2-p1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Reproduced on 2.4.2 Severity: S1 Affects critical data or functionality and forces users to employ a workaround.

Comments

@msyhr
Copy link

msyhr commented Jun 24, 2021

Preconditions (*)

Install 2.4.2-p1 or run composer-update on an existing install that hasn't been run in hours since 2.7.1 was release.

Steps to reproduce (*)

View any page with callout for

<?= $block->getReviewsSummaryHtml($_product, $templateType) ?>

Might be more widespread than this, but this is how I noticed it.

Happened on a client's instance, thought it might be related to one of their many 3rd party extensions. Quickly installed a blank 2.4.2-p1 instance w/sample data. Saw the result

Expected result (*)

Page loads

Actual result (*)

Screenshot 2021-06-24 at 16-18-36 https 242test loc

Partial page load with stack trace output

TypeError: rawurlencode() expects parameter 1 to be string, bool given in /shared/httpd/242test/htdocs/vendor/laminas/laminas-escaper/src/Escaper.php:246 Stack trace: #0 /shared/httpd/242test/htdocs/vendor/laminas/laminas-escaper/src/Escaper.php(246): rawurlencode(true) #1 /shared/httpd/242test/htdocs/vendor/magento/framework/Escaper.php(286): Laminas\Escaper\Escaper->escapeUrl(true) #2 /shared/httpd/242test/htdocs/vendor/magento/framework/Url/RouteParamsResolver.php(115): Magento\Framework\Escaper->encodeUrlParam(true) #3 /shared/httpd/242test/htdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\Url\RouteParamsResolver->setRouteParams(Array, false) #4 /shared/httpd/242test/htdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Url\RouteParamsResolver\Interceptor->___callParent('setRouteParams', Array) #5 /shared/httpd/242test/htdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\Url\RouteParamsResolver\Interceptor->Magento\Framework\Interception\{closure}(Array, false) #6 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/Url/RouteParamsResolver/Interceptor.php(23): Magento\Framework\Url\RouteParamsResolver\Interceptor->___callPlugins('setRouteParams', Array, Array) #7 /shared/httpd/242test/htdocs/vendor/magento/framework/Url.php(716): Magento\Framework\Url\RouteParamsResolver\Interceptor->setRouteParams(Array, false) #8 /shared/httpd/242test/htdocs/vendor/magento/framework/Url.php(747): Magento\Framework\Url->_setRouteParams(Array, false) #9 /shared/httpd/242test/htdocs/vendor/magento/framework/Url.php(929): Magento\Framework\Url->getRouteUrl('', Array) #10 /shared/httpd/242test/htdocs/vendor/magento/framework/Url.php(873): Magento\Framework\Url->createUrl('', Array) #11 /shared/httpd/242test/htdocs/vendor/magento/module-catalog/Model/Product/Url.php(199): Magento\Framework\Url->getUrl('', Array) #12 /shared/httpd/242test/htdocs/vendor/magento/module-review/Block/Product/ReviewRenderer.php(149): Magento\Catalog\Model\Product\Url->getUrl(Object(Magento\Catalog\Model\Product\Interceptor), Array) #13 /shared/httpd/242test/htdocs/generated/code/Magento/Review/Block/Product/ReviewRenderer/Interceptor.php(59): Magento\Review\Block\Product\ReviewRenderer->getReviewsUrl(false) #14 /shared/httpd/242test/htdocs/vendor/magento/module-review/view/frontend/templates/helper/summary.phtml(12): Magento\Review\Block\Product\ReviewRenderer\Interceptor->getReviewsUrl() #15 /shared/httpd/242test/htdocs/vendor/magento/framework/View/TemplateEngine/Php.php(71): include('/shared/httpd/2...') #16 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Element/Template.php(273): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Review\Block\Product\ReviewRenderer\Interceptor), '/shared/httpd/2...', Array) #17 /shared/httpd/242test/htdocs/generated/code/Magento/Review/Block/Product/ReviewRenderer/Interceptor.php(122): Magento\Framework\View\Element\Template->fetchView('/shared/httpd/2...') #18 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Element/Template.php(303): Magento\Review\Block\Product\ReviewRenderer\Interceptor->fetchView('/shared/httpd/2...') #19 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Element/AbstractBlock.php(1111): Magento\Framework\View\Element\Template->_toHtml() #20 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Element/AbstractBlock.php(1115): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() #21 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Element/AbstractBlock.php(675): Magento\Framework\View\Element\AbstractBlock->_loadCache() #22 /shared/httpd/242test/htdocs/generated/code/Magento/Review/Block/Product/ReviewRenderer/Interceptor.php(347): Magento\Framework\View\Element\AbstractBlock->toHtml() #23 /shared/httpd/242test/htdocs/vendor/magento/module-review/Block/Product/ReviewRenderer.php(111): Magento\Review\Block\Product\ReviewRenderer\Interceptor->toHtml() #24 /shared/httpd/242test/htdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Review\Block\Product\ReviewRenderer->getReviewsSummaryHtml(Object(Magento\Catalog\Model\Product\Interceptor), 'default', true) #25 /shared/httpd/242test/htdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Review\Block\Product\ReviewRenderer\Interceptor->___callParent('getReviewsSumma...', Array) #26 /shared/httpd/242test/htdocs/vendor/yotpo/magento2-module-yotpo-reviews/Plugin/Review/Block/Product/ReviewRenderer.php(32): Magento\Review\Block\Product\ReviewRenderer\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Catalog\Model\Product\Interceptor), false, true) #27 /shared/httpd/242test/htdocs/vendor/magento/framework/Interception/Interceptor.php(135): Yotpo\Yotpo\Plugin\Review\Block\Product\ReviewRenderer->aroundGetReviewsSummaryHtml(Object(Magento\Review\Block\Product\ReviewRenderer\Interceptor), Object(Closure), Object(Magento\Catalog\Model\Product\Interceptor), false, true) #28 /shared/httpd/242test/htdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Review\Block\Product\ReviewRenderer\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Catalog\Model\Product\Interceptor), false, true) #29 /shared/httpd/242test/htdocs/generated/code/Magento/Review/Block/Product/ReviewRenderer/Interceptor.php(32): Magento\Review\Block\Product\ReviewRenderer\Interceptor->___callPlugins('getReviewsSumma...', Array, NULL) #30 /shared/httpd/242test/htdocs/vendor/magento/module-catalog/Block/Product/AbstractProduct.php(221): Magento\Review\Block\Product\ReviewRenderer\Interceptor->getReviewsSummaryHtml(Object(Magento\Catalog\Model\Product\Interceptor), false, true) #31 /shared/httpd/242test/htdocs/generated/code/Magento/Catalog/Block/Product/View/Interceptor.php(176): Magento\Catalog\Block\Product\AbstractProduct->getReviewsSummaryHtml(Object(Magento\Catalog\Model\Product\Interceptor), false, true) #32 /shared/httpd/242test/htdocs/vendor/magento/module-catalog/view/frontend/templates/product/view/review.phtml(8): Magento\Catalog\Block\Product\View\Interceptor->getReviewsSummaryHtml(Object(Magento\Catalog\Model\Product\Interceptor), false, true) #33 /shared/httpd/242test/htdocs/vendor/magento/framework/View/TemplateEngine/Php.php(71): include('/shared/httpd/2...') #34 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Element/Template.php(273): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Catalog\Block\Product\View\Interceptor), '/shared/httpd/2...', Array) #35 /shared/httpd/242test/htdocs/generated/code/Magento/Catalog/Block/Product/View/Interceptor.php(383): Magento\Framework\View\Element\Template->fetchView('/shared/httpd/2...') #36 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Element/Template.php(303): Magento\Catalog\Block\Product\View\Interceptor->fetchView('/shared/httpd/2...') #37 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Element/AbstractBlock.php(1111): Magento\Framework\View\Element\Template->_toHtml() #38 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Element/AbstractBlock.php(1115): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}() #39 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Element/AbstractBlock.php(675): Magento\Framework\View\Element\AbstractBlock->_loadCache() #40 /shared/httpd/242test/htdocs/generated/code/Magento/Catalog/Block/Product/View/Interceptor.php(608): Magento\Framework\View\Element\AbstractBlock->toHtml() #41 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(578): Magento\Catalog\Block\Product\View\Interceptor->toHtml() #42 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(555): Magento\Framework\View\Layout->_renderBlock('product.info.re...') #43 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement('product.info.re...') #44 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('product.info.re...') #45 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement('product.info.re...', false) #46 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement('product.info.re...', false) #47 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('product.info.ma...', false) #48 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement('product.info.ma...') #49 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('product.info.ma...') #50 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement('product.info.ma...', false) #51 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement('product.info.ma...', false) #52 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('content', false) #53 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement('content') #54 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('content') #55 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement('content', false) #56 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement('content', false) #57 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('main', false) #58 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement('main') #59 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main') #60 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement('main', false) #61 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement('main', false) #62 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('columns', false) #63 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement('columns') #64 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('columns') #65 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement('columns', false) #66 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement('columns', false) #67 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('main.content', false) #68 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement('main.content') #69 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main.content') #70 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement('main.content', false) #71 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement('main.content', false) #72 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('page.wrapper', false) #73 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper') #74 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper') #75 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement('page.wrapper', false) #76 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement('page.wrapper', false) #77 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('root', false) #78 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement('root') #79 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root') #80 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement('root', true) #81 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Layout.php(975): Magento\Framework\View\Layout\Interceptor->renderElement('root') #82 /shared/httpd/242test/htdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->getOutput() #83 /shared/httpd/242test/htdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent('getOutput', Array) #84 /shared/httpd/242test/htdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}() #85 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(347): Magento\Framework\View\Layout\Interceptor->___callPlugins('getOutput', Array, Array) #86 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Result/Page.php(258): Magento\Framework\View\Layout\Interceptor->getOutput() #87 /shared/httpd/242test/htdocs/vendor/magento/framework/View/Result/Layout.php(171): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor)) #88 /shared/httpd/242test/htdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor)) #89 /shared/httpd/242test/htdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Result\Page\Interceptor->___callParent('renderResult', Array) #90 /shared/httpd/242test/htdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor)) #91 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/View/Result/Page/Interceptor.php(95): Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', Array, Array) #92 /shared/httpd/242test/htdocs/vendor/magento/framework/App/Http.php(120): Magento\Framework\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor)) #93 /shared/httpd/242test/htdocs/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch() #94 /shared/httpd/242test/htdocs/vendor/magento/framework/App/Bootstrap.php(263): Magento\Framework\App\Http\Interceptor->launch() #95 /shared/httpd/242test/htdocs/pub/index.php(29): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor)) #96 {main}

Resolution (*)

Force composer to use 2.7.0 and reload page, page loads with no issues.

  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
@m2-assistant
Copy link

m2-assistant bot commented Jun 24, 2021

Hi @msyhr. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

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.

Please, add a comment to assign the issue: @magento I am working on this


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@laurnts
Copy link

laurnts commented Jun 25, 2021

I also have the same issue, was quite striking since yesterday I didn't find this issue while updating composer.json

@sebastian-ehrling
Copy link

Currently there is an error in laminas-escaper. You can add the following to your composer.json and run composer update. This is only a temporary fix for this problem.
"require": {
"magento/product-community-edition": "2.4.2-p1",
"laminas/laminas-escaper": "2.7.0"
},

@mrtuvn mrtuvn added the Reported on 2.4.2-p1 Indicates original Magento version for the Issue report. label Jun 25, 2021
@mrtuvn
Copy link
Contributor

mrtuvn commented Jun 25, 2021

i can also reproduced with latest code base magento + laminas/laminas-escaper 2.7.1 + Sample data contain review data product. Category page will break with similar error
Not sure this issue can happen with clean install no sample data ?

@nobodyMO
Copy link

I also spent a few hours yesterday troubleshooting after installing 2.4.2p1.

Sorry but you are making it a little too easy to blame laminas-escaper.
There with 2.7.1. the Coding guidelines were inserted and thereby also the type check activated (declare(strict_types=1););
The input type of the function was also declared as string before.

     * @param string $string
     * @return string
     */
    public function escapeUrl($string)

The lib doesn't even enforce this type, but by enabling type checking it now impacts the function rawurlencode used in this function.

Und URL-Encode ist PHP Standard.

rawurlencode ( string $string ) : string

Activating the type check is not a mistake and I don't think they will take it back.

All values are passed from Magento to the function unchecked, regardless of whether they are a string or not.
Now the implicit cast is missing. This must be done explicitly in Magento or the function must no longer be called for types other than string.

@Skyfly2021
Copy link

image
I also have this problem. The front-end product details page cannot be displayed, and the back-end management page also has an error. After downgrading the module version, the problem disappears.
composer require laminas/laminas-escaper:2.7.0

@mrtuvn mrtuvn added Component: Framework/Url Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Reproduced on 2.4.2 and removed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch labels Jun 25, 2021
@laurnts
Copy link

laurnts commented Jun 25, 2021

Currently there is an error in laminas-escaper. You can add the following to your composer.json and run composer update. This is only a temporary fix for this problem.
"require": {
"magento/product-community-edition": "2.4.2-p1",
"laminas/laminas-escaper": "2.7.0"
},

This is also the solution I am using, downgrading the version back to 2.7.0. This is not only happening for Magento 2.4.2, but also Magento 2.4.2-p1 as well as 2.3.6. I believed all versions of Magento 2 using laminas are affected. This error pages also only affect pages with a product grid and product detail page (If I am correct, if review ratings are loaded within the page).

@m2-community-project m2-community-project bot added the Severity: S1 Affects critical data or functionality and forces users to employ a workaround. label Jun 25, 2021
@pcGarethJames
Copy link

Just as an FYI for those affected by this issue. I've also had this happen on 2.3.7

@zaietsv
Copy link

zaietsv commented Jun 25, 2021

I am facing the same bug at Magento 2.4.2-p1. Please fix immediately!

@ihor-sviziev ihor-sviziev added Severity: S0 A problem that is blocking the ability to work. An immediate fix is needed. and removed Severity: S1 Affects critical data or functionality and forces users to employ a workaround. labels Jun 25, 2021
@m2-community-project m2-community-project bot added Priority: P0 This generally occurs in cases when the entire functionality is blocked. Severity: S1 Affects critical data or functionality and forces users to employ a workaround. labels Jun 25, 2021
@ihor-sviziev ihor-sviziev removed the Severity: S0 A problem that is blocking the ability to work. An immediate fix is needed. label Jun 25, 2021
@ProxiBlue
Copy link

ref: laminas/laminas-escaper#20

@n2diving-dgx
Copy link

I can confirm laminas-escaper 2.7.1 breaks M2 in a clean install w/sample data for 2.3.7 as well as 2.4.2 My workaround...

composer require "laminas/laminas-escaper:<2.7.0"

@barryvdh
Copy link
Contributor

Is this fixed with the latest Laminas Escaper release now? https://github.com/laminas/laminas-escaper/releases/tag/2.8.0
That should cast the argument to a string now.

@template-provider
Copy link

I also spent a few hours yesterday troubleshooting after installing 2.4.2p1.

Sorry but you are making it a little too easy to blame laminas-escaper.
There with 2.7.1. the Coding guidelines were inserted and thereby also the type check activated (declare(strict_types=1););
The input type of the function was also declared as string before.

     * @param string $string
     * @return string
     */
    public function escapeUrl($string)

The lib doesn't even enforce this type, but by enabling type checking it now impacts the function rawurlencode used in this function.

Und URL-Encode ist PHP Standard.

rawurlencode ( string $string ) : string

Activating the type check is not a mistake and I don't think they will take it back.

All values are passed from Magento to the function unchecked, regardless of whether they are a string or not.
Now the implicit cast is missing. This must be done explicitly in Magento or the function must no longer be called for types other than string.

I see that a little bit different to blame magento for that... from the client it looks like a breaking change ... with a bugfix release.
laminas/laminas-escaper#20 (comment)
AND ... until PHP 8.0 with Attributes .... phpdoc is not an official type hint. before the method accepts other values than strings.... now it breaks.
I think the accepted pull for that from laminas says clearly: a breaking change inside a patch => not a good idea

besides that ... i can live with forcing 2.7.0 until magento fixes the strict types.

@Hanhan1989
Copy link

After executing composer update, the problem resolved. Thanks so much

@hostep
Copy link
Contributor

hostep commented Jun 27, 2021

Confirmed, indeed upgrading laminas/laminas-escaper to version 2.8.0 fixes this problem.

@mrtuvn
Copy link
Contributor

mrtuvn commented Jun 28, 2021

i think upgrade laminas package is not enough. Magento also need patch from codebase too.
Note: issue not only happen in frontend but also in admin able broken function too. Ex: Go to page create new entity (Catalog, Categories)
laminas escaper 2.8.0 => TypeError: Argument 1 passed to Laminas\Escaper\Escaper::escapeUrl() must be of the type string, int given

@hostep
Copy link
Contributor

hostep commented Jun 28, 2021

@mrtuvn: I can't reproduce what you are saying, but I'm not using a vanilla installation at the moment.

Can you add more detailed steps and maybe also a stacktrace for your case?

@pcGarethJames
Copy link

I've retested on 2.3.7 and can confirm laminas escaper 2.8.0 resolves the issue.

I'm using a set up with sample data installed, and cannot replicate the error that @mrtuvn indicates either. So more info will be required for that one

@mrtuvn
Copy link
Contributor

mrtuvn commented Jun 28, 2021

I'm not sure but i have tested in my local dev (developer mode) with latest code base (no sample data) and upgraded laminas escaper to latest. Problem still be the same (without patch). Broken layout in details, category, admin(categories and product new entity page)
Error text now changed to previous text that i mentioned
called in /var/www/html/lib/internal/Magento/Framework/Escaper.php on line 294 and defined in /var/www/html/vendor/laminas/laminas-escaper/src/Escaper.php:232

@hostep
Copy link
Contributor

hostep commented Jun 28, 2021

@mrtuvn: do you have a stack trace?

@mrtuvn
Copy link
Contributor

mrtuvn commented Jun 28, 2021

Screenshot from 2021-06-28 17-29-34
category page in admin

@hostep
Copy link
Contributor

hostep commented Jun 28, 2021

Ah, I just noticed that on 2.4-develop they also added declare(strict_types=1); via: 1a481b4

That might explain it.

This line is not part of 2.4.2-p1, so it only crashes on the 2.4-develop branch at the moment.

So that line should be released together with #33353 when it is properly fixed.
So somebody should make sure that MC-23553 is not included in Magento 2.4.3 yet until the PR above has been finished completely.

(/cc @fascinosum )

@ghost
Copy link

ghost commented Jun 28, 2021

I have a lot of this issue in system.log but not sure that is related. I can not how to reproduce it.

[2021-06-28 11:59:14] main.CRITICAL: TypeError: html_entity_decode() expects parameter 1 to be string, null given in /var/www/html/vendor/magento/framework/Escaper.php:366
Stack trace:
#0 /var/www/html/vendor/magento/framework/Escaper.php(366): html_entity_decode()
#1 /var/www/html/vendor/magento/framework/Escaper.php(282): Magento\Framework\Escaper->escapeXssInUrl()
#2 /var/www/html/var/view_preprocessed/pub/static/vendor/magento/module-customer/view/frontend/templates/form/register.phtml(1): Magento\Framework\Escaper->escapeUrl()
#3 /var/www/html/vendor/magento/framework/View/TemplateEngine/Php.php(71): include('/var/www/html/v...')
#4 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\TemplateEngine\Php->render()
#5 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent()
#6 /var/www/html/vendor/amasty/module-fpc-warmer/Plugin/Holepunch/TemplateRenderer.php(58): Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception{closure}()
#7 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(135): Amasty\Fpc\Plugin\Holepunch\TemplateRenderer->aroundRender()
#8 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception{closure}()
#9 /var/www/html/generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php(23): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callPlugins()
#10 /var/www/html/vendor/magento/framework/View/Element/Template.php(273): Magento\Framework\View\TemplateEngine\Php\Interceptor->render()
#11 /var/www/html/vendor/magento/framework/View/Element/Template.php(303): Magento\Framework\View\Element\Template->fetchView()
#12 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(1111): Magento\Framework\View\Element\Template->_toHtml()
#13 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(1115): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element{closure}()
#14 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(675): Magento\Framework\View\Element\AbstractBlock->_loadCache()
#15 /var/www/html/vendor/magento/framework/View/Layout.php(578): Magento\Framework\View\Element\AbstractBlock->toHtml()
#16 /var/www/html/vendor/magento/framework/View/Layout.php(555): Magento\Framework\View\Layout->_renderBlock()
#17 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#18 /var/www/html/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#19 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#20 /var/www/html/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement()
#21 /var/www/html/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#22 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#23 /var/www/html/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#24 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#25 /var/www/html/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement()
#26 /var/www/html/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#27 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#28 /var/www/html/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#29 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#30 /var/www/html/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement()
#31 /var/www/html/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#32 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#33 /var/www/html/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#34 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#35 /var/www/html/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement()
#36 /var/www/html/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#37 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#38 /var/www/html/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#39 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#40 /var/www/html/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement()
#41 /var/www/html/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#42 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#43 /var/www/html/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#44 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#45 /var/www/html/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement()
#46 /var/www/html/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#47 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement()
#48 /var/www/html/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement()
#49 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(140): Magento\Framework\View\Layout->renderElement()
#50 /var/www/html/vendor/magento/framework/View/Layout.php(975): Magento\Framework\View\Layout\Interceptor->renderElement()
#51 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->getOutput()
#52 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent()
#53 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception{closure}()
#54 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(347): Magento\Framework\View\Layout\Interceptor->___callPlugins()
#55 /var/www/html/vendor/magento/framework/View/Result/Page.php(258): Magento\Framework\View\Layout\Interceptor->getOutput()
#56 /var/www/html/vendor/magento/framework/View/Result/Layout.php(171): Magento\Framework\View\Result\Page->render()
#57 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Result\Layout->renderResult()
#58 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Result\Page\Interceptor->___callParent()
#59 /var/www/html/vendor/amasty/gdpr-cookie/Plugin/ProcessPageResult.php(65): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception{closure}()
#60 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(135): Amasty\GdprCookie\Plugin\ProcessPageResult->aroundRenderResult()
#61 /var/www/html/vendor/amasty/module-page-speed-tools/Plugin/ProcessPageResult.php(46): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception{closure}()
#62 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(135): Amasty\PageSpeedTools\Plugin\ProcessPageResult->aroundRenderResult()
#63 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception{closure}()
#64 /var/www/html/generated/code/Magento/Framework/View/Result/Page/Interceptor.php(95): Magento\Framework\View\Result\Page\Interceptor->___callPlugins()
#65 /var/www/html/vendor/magento/framework/App/Http.php(120): Magento\Framework\View\Result\Page\Interceptor->renderResult()
#66 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Http->launch()
#67 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\Http\Interceptor->___callParent()
#68 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception{closure}()
#69 /var/www/html/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http\Interceptor->___callPlugins()
#70 /var/www/html/vendor/magento/framework/App/Bootstrap.php(263): Magento\Framework\App\Http\Interceptor->launch()
#71 /var/www/html/pub/index.php(29): Magento\Framework\App\Bootstrap->run()
#72 {main} [] []

@alinolandry
Copy link

i think upgrade laminas package is not enough. Magento also need patch from codebase too.
Note: issue not only happen in frontend but also in admin able broken function too. Ex: Go to page create new entity (Catalog, Categories)
laminas escaper 2.8.0 => TypeError: Argument 1 passed to Laminas\Escaper\Escaper::escapeUrl() must be of the type string, int given

Yes...I got the same issue in admin Catalog -> Categories or Catalog -> product -> Clic on one product you should get same issue on M2.4.2

@msyhr
Copy link
Author

msyhr commented Jun 28, 2021

i think upgrade laminas package is not enough. Magento also need patch from codebase too.
Note: issue not only happen in frontend but also in admin able broken function too. Ex: Go to page create new entity (Catalog, Categories)
laminas escaper 2.8.0 => TypeError: Argument 1 passed to Laminas\Escaper\Escaper::escapeUrl() must be of the type string, int given

Yes...I got the same issue in admin Catalog -> Categories or Catalog -> product -> Clic on one product you should get same issue on M2.4.2

FYI if you're using 2.4.2.-p1, hard locking the laminas-escaper lib to 2.7.0 is probably going to be your only option for now.

Screenshot from 2021-06-28 10-34-42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Framework/Escaper Component: Framework/Url Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P0 This generally occurs in cases when the entire functionality is blocked. Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reported on 2.4.2-p1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Reproduced on 2.4.2 Severity: S1 Affects critical data or functionality and forces users to employ a workaround.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.