diff --git a/src/Assetic/Asset/HttpAsset.php b/src/Assetic/Asset/HttpAsset.php index bf8b9ba..5a507f9 100644 --- a/src/Assetic/Asset/HttpAsset.php +++ b/src/Assetic/Asset/HttpAsset.php @@ -58,11 +58,13 @@ public function load(?FilterInterface $additionalFilter = null) public function getLastModified() { if (false !== @file_get_contents($this->sourceUrl, false, stream_context_create(array('http' => array('method' => 'HEAD'))))) { - // TODO: $http_response_header deprecated since PHP 8.5 - // Remove when min PHP >= 8.4 and use http_get_last_response_headers() directly + // http_get_last_response_headers() was added in PHP 8.4; older versions fall back + // to the predefined $http_response_header. The `?? []` coalescing read avoids the + // PHP 8.5 deprecation of that variable: a bare read is flagged at compile time, + // a coalescing read is not. Drop the fallback once the minimum PHP version is >= 8.4. $headers = function_exists('http_get_last_response_headers') ? http_get_last_response_headers() - : $http_response_header; + : ($http_response_header ?? []); foreach ($headers as $header) { if (0 === stripos($header, 'Last-Modified: ')) { list(, $mtime) = explode(':', $header, 2); diff --git a/src/Assetic/Factory/Loader/BasePhpFormulaLoader.php b/src/Assetic/Factory/Loader/BasePhpFormulaLoader.php index 75e039f..4c2bf86 100644 --- a/src/Assetic/Factory/Loader/BasePhpFormulaLoader.php +++ b/src/Assetic/Factory/Loader/BasePhpFormulaLoader.php @@ -105,7 +105,8 @@ private function processCall($call, array $protoOptions = []) $call, 'echo serialize($_call);', ))); - $args = unserialize(shell_exec('php ' . escapeshellarg($tmp))); + $output = shell_exec('php ' . escapeshellarg($tmp)); + $args = is_string($output) ? unserialize($output) : []; unlink($tmp); $inputs = isset($args[0]) ? self::argumentToArray($args[0]) : []; diff --git a/src/Assetic/Filter/CssImportFilter.php b/src/Assetic/Filter/CssImportFilter.php index 882ab7a..a7abc2f 100644 --- a/src/Assetic/Filter/CssImportFilter.php +++ b/src/Assetic/Filter/CssImportFilter.php @@ -7,6 +7,7 @@ use Assetic\Asset\HttpAsset; use Assetic\Factory\AssetFactory; use Assetic\Contracts\Filter\DependencyExtractorInterface; +use Assetic\Contracts\Filter\FilterInterface; /** * Inlines imported stylesheets.