yireo / Yireo_LinkPreload

Magento 2 extension to set HTTP Link headers for primary resources to allow for HTTP/2 Server Push
Open Software License 3.0
74 stars 18 forks source link

ResponsePlugin edge case error #44

Closed MaximGns closed 1 year ago

MaximGns commented 1 year ago

Discovered an edge case issue during install/testing on a running project.

Magento version: 2.4.5-p1 PHP version: 8.1 Yireo_LinkPreload version: latest

`==> system.log <== [2023-05-24T14:07:41.690339+00:00] report.CRITICAL: TypeError: stristr(): Argument https://github.com/yireo/Yireo_LinkPreload/pull/1 ($haystack) must be of type string, null given in /app/#/vendor/yireo/magento2-linkpreload/Plugin/ResponsePlugin.php:104 Stack trace:

0 /app/#/vendor/yireo/magento2-linkpreload/Plugin/ResponsePlugin.php(104): stristr(NULL, '<!doctype html>')

https://github.com/yireo/Yireo_LinkPreload/pull/1 /app/#/vendor/yireo/magento2-linkpreload/Plugin/ResponsePlugin.php(71): Yireo\LinkPreload\Plugin\ResponsePlugin->shouldAddLinkHeader(Object(Magento\Framework\App\Response\Http\Interceptor)) https://github.com/yireo/Yireo_LinkPreload/pull/2 /app/#/vendor/magento/framework/Interception/Interceptor.php(121): Yireo\LinkPreload\Plugin\ResponsePlugin->beforeSendResponse(Object(Magento\Framework\App\Response\Http\Interceptor)) https://github.com/yireo/Yireo_LinkPreload/issues/3 /app/#/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Response\Http\Interceptor->Magento\Framework\Interception{closure}() https://github.com/yireo/Yireo_LinkPreload/pull/4 /app/#/generated/code/Magento/Framework/App/Response/Http/Interceptor.php(23): Magento\Framework\App\Response\Http\Interceptor->___callPlugins('sendResponse', Array, Array) https://github.com/yireo/Yireo_LinkPreload/pull/5 /app/#/vendor/magento/framework/App/Bootstrap.php(265): Magento\Framework\App\Response\Http\Interceptor->sendResponse() https://github.com/yireo/Yireo_LinkPreload/issues/6 /app/#/pub/index.php(30): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor)) https://github.com/yireo/Yireo_LinkPreload/pull/7 {main} [] []`

Related PR: https://github.com/yireo/Yireo_LinkPreload/pull/43#issue-1724124030