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

Fix stringing of content #43

Closed MaximGns closed 1 year ago

MaximGns commented 1 year ago

Edge case error discoverd

==> system.log <== [2023-05-24T14:07:41.690339+00:00] report.CRITICAL: TypeError: stristr(): Argument #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>')

1 /app/#/vendor/yireo/magento2-linkpreload/Plugin/ResponsePlugin.php(71): Yireo\LinkPreload\Plugin\ResponsePlugin->shouldAddLinkHeader(Object(Magento\Framework\App\Response\Http\Interceptor))

2 /app/#/vendor/magento/framework/Interception/Interceptor.php(121): Yireo\LinkPreload\Plugin\ResponsePlugin->beforeSendResponse(Object(Magento\Framework\App\Response\Http\Interceptor))

3 /app/#/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Response\Http\Interceptor->Magento\Framework\Interception{closure}()

4 /app/#/generated/code/Magento/Framework/App/Response/Http/Interceptor.php(23): Magento\Framework\App\Response\Http\Interceptor->___callPlugins('sendResponse', Array, Array)

5 /app/#/vendor/magento/framework/App/Bootstrap.php(265): Magento\Framework\App\Response\Http\Interceptor->sendResponse()

6 /app/#/pub/index.php(30): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))

7 {main} [] []

jissereitsma commented 1 year ago

Thanks. A simple but needed fix! I'm going to merge this one right away, but also taking a look at some other issues before releasing. Thanks again!