Closed jasperzeinstra closed 3 years ago
We receive a warning on 404 pages when the request path is only 3 characters long, like 'https://www.webshop.nl/asd'
1.A warning is thrown: Warning: strpos(): Offset not contained in string
The regular 404 page is shown.
Tech hint -- See comment in: https://github.com/EmicoEcommerce/Magento2Tweakwise/commit/fb28e32ef60b2965e2017ebc0a4ee27e83b68ba2
you're working with a negative offset for Strpos, but you're not checking if the string is as long or longer then the provided negative offset. This will throw an error on 404 url's with only 3 charachters.
\Emico\Tweakwise\Model\Catalog\Layer\Url\Strategy\PathSlugStrategy::skip
$requestPath = 'asd'; $fileExtention = '.jpg'; echo strpos($requestPath, $fileExtention, -\strlen($fileExtention));
Will throw the error: Warning: strpos(): Offset not contained in string
Warning: strpos(): Offset not contained in string
Thanks, issue is clear
https://github.com/EmicoEcommerce/Magento2Tweakwise/releases/tag/v3.0.3 should fix this issue. We did not take that into account :( Thanks for pointing that out
Issue Brief
We receive a warning on 404 pages when the request path is only 3 characters long, like 'https://www.webshop.nl/asd'
Environment
Steps to reproduce
Actual result
1.A warning is thrown: Warning: strpos(): Offset not contained in string
Expected result
The regular 404 page is shown.
Tech hint -- See comment in: https://github.com/EmicoEcommerce/Magento2Tweakwise/commit/fb28e32ef60b2965e2017ebc0a4ee27e83b68ba2
you're working with a negative offset for Strpos, but you're not checking if the string is as long or longer then the provided negative offset. This will throw an error on 404 url's with only 3 charachters.
\Emico\Tweakwise\Model\Catalog\Layer\Url\Strategy\PathSlugStrategy::skip
Will throw the error:
Warning: strpos(): Offset not contained in string