From 70c7e95887eab24de72cf045f8ee4c16907a9ad9 Mon Sep 17 00:00:00 2001 From: Thomas Skerbis Date: Fri, 3 Jan 2025 19:36:35 +0100 Subject: [PATCH] vendor v3.0.2 --- composer.lock | 6 +- vendor/composer/installed.json | 48 +++--- vendor/composer/installed.php | 22 +-- vendor/dompdf/dompdf/README.md | 7 +- vendor/dompdf/dompdf/VERSION | 2 +- vendor/dompdf/dompdf/composer.json | 2 +- vendor/dompdf/dompdf/lib/Cpdf.php | 8 +- vendor/dompdf/dompdf/phpunit.xml | 20 +++ vendor/dompdf/dompdf/src/Css/Style.php | 4 +- vendor/dompdf/dompdf/src/Css/Stylesheet.php | 89 ++++++++--- vendor/dompdf/dompdf/src/Frame.php | 12 +- .../FrameDecorator/AbstractFrameDecorator.php | 2 +- .../FrameReflower/AbstractFrameReflower.php | 2 +- .../dompdf/dompdf/src/FrameReflower/Block.php | 4 +- .../dompdf/dompdf/src/FrameReflower/Image.php | 2 +- .../dompdf/src/FrameReflower/Inline.php | 2 +- .../dompdf/src/FrameReflower/ListBullet.php | 2 +- .../src/FrameReflower/NullFrameReflower.php | 2 +- .../dompdf/dompdf/src/FrameReflower/Page.php | 2 +- .../dompdf/dompdf/src/FrameReflower/Table.php | 2 +- .../dompdf/src/FrameReflower/TableCell.php | 2 +- .../dompdf/src/FrameReflower/TableRow.php | 2 +- .../src/FrameReflower/TableRowGroup.php | 2 +- .../dompdf/dompdf/src/FrameReflower/Text.php | 2 +- vendor/dompdf/dompdf/src/Helpers.php | 10 +- vendor/dompdf/dompdf/src/Image/Cache.php | 2 +- vendor/dompdf/dompdf/src/Options.php | 6 +- .../src/FontLib/TrueType/File.php | 2 +- vendor/sabberworm/php-css-parser/CHANGELOG.md | 147 ++++++++++++++---- .../sabberworm/php-css-parser/composer.json | 4 +- .../src/CSSList/AtRuleBlockList.php | 4 +- .../php-css-parser/src/CSSList/CSSList.php | 16 ++ .../php-css-parser/src/CSSList/Document.php | 6 +- .../php-css-parser/src/CSSList/KeyFrame.php | 4 +- .../php-css-parser/src/Comment/Comment.php | 4 +- .../sabberworm/php-css-parser/src/Parser.php | 6 +- .../php-css-parser/src/Parsing/Anchor.php | 3 + .../src/Parsing/ParserState.php | 5 + .../php-css-parser/src/Property/AtRule.php | 4 + .../src/Property/CSSNamespace.php | 4 +- .../php-css-parser/src/Property/Charset.php | 4 +- .../php-css-parser/src/Property/Import.php | 4 +- .../src/Property/KeyframeSelector.php | 2 + .../php-css-parser/src/Property/Selector.php | 6 + .../php-css-parser/src/Renderable.php | 4 +- .../php-css-parser/src/Rule/Rule.php | 5 +- .../php-css-parser/src/RuleSet/AtRuleSet.php | 4 +- .../src/RuleSet/DeclarationBlock.php | 30 +++- .../php-css-parser/src/RuleSet/RuleSet.php | 2 +- .../php-css-parser/src/Value/CSSFunction.php | 4 +- .../php-css-parser/src/Value/CSSString.php | 4 +- .../php-css-parser/src/Value/CalcFunction.php | 6 +- .../src/Value/CalcRuleValueList.php | 4 +- .../php-css-parser/src/Value/Color.php | 13 +- .../php-css-parser/src/Value/LineName.php | 4 +- .../php-css-parser/src/Value/Size.php | 19 ++- .../php-css-parser/src/Value/URL.php | 4 +- .../php-css-parser/src/Value/Value.php | 30 +++- .../php-css-parser/src/Value/ValueList.php | 4 +- 59 files changed, 464 insertions(+), 164 deletions(-) create mode 100644 vendor/dompdf/dompdf/phpunit.xml diff --git a/composer.lock b/composer.lock index 25fee41..754fd41 100644 --- a/composer.lock +++ b/composer.lock @@ -297,10 +297,10 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [], + "platform": {}, + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index c144d20..e505883 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2,17 +2,17 @@ "packages": [ { "name": "dompdf/dompdf", - "version": "v3.0.0", - "version_normalized": "3.0.0.0", + "version": "v3.0.2", + "version_normalized": "3.0.2.0", "source": { "type": "git", "url": "https://github.com/dompdf/dompdf.git", - "reference": "fbc7c5ee5d94f7a910b78b43feb7931b7f971b59" + "reference": "baf4084b27c7f4b5b7a221b19a94d11327664eb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dompdf/dompdf/zipball/fbc7c5ee5d94f7a910b78b43feb7931b7f971b59", - "reference": "fbc7c5ee5d94f7a910b78b43feb7931b7f971b59", + "url": "https://api.github.com/repos/dompdf/dompdf/zipball/baf4084b27c7f4b5b7a221b19a94d11327664eb8", + "reference": "baf4084b27c7f4b5b7a221b19a94d11327664eb8", "shasum": "" }, "require": { @@ -28,7 +28,7 @@ "ext-json": "*", "ext-zip": "*", "mockery/mockery": "^1.3", - "phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10", + "phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11", "squizlabs/php_codesniffer": "^3.5", "symfony/process": "^4.4 || ^5.4 || ^6.2 || ^7.0" }, @@ -38,7 +38,7 @@ "ext-imagick": "Improves image processing performance", "ext-zlib": "Needed for pdf stream compression" }, - "time": "2024-04-29T14:01:28+00:00", + "time": "2024-12-27T20:27:37+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -63,23 +63,23 @@ "homepage": "https://github.com/dompdf/dompdf", "support": { "issues": "https://github.com/dompdf/dompdf/issues", - "source": "https://github.com/dompdf/dompdf/tree/v3.0.0" + "source": "https://github.com/dompdf/dompdf/tree/v3.0.2" }, "install-path": "../dompdf/dompdf" }, { "name": "dompdf/php-font-lib", - "version": "1.0.0", - "version_normalized": "1.0.0.0", + "version": "1.0.1", + "version_normalized": "1.0.1.0", "source": { "type": "git", "url": "https://github.com/dompdf/php-font-lib.git", - "reference": "991d6a954f6bbd7e41022198f00586b230731441" + "reference": "6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/991d6a954f6bbd7e41022198f00586b230731441", - "reference": "991d6a954f6bbd7e41022198f00586b230731441", + "url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d", + "reference": "6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d", "shasum": "" }, "require": { @@ -89,7 +89,7 @@ "require-dev": { "symfony/phpunit-bridge": "^3 || ^4 || ^5 || ^6" }, - "time": "2024-04-29T13:40:38+00:00", + "time": "2024-12-02T14:37:59+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -111,7 +111,7 @@ "homepage": "https://github.com/dompdf/php-font-lib", "support": { "issues": "https://github.com/dompdf/php-font-lib/issues", - "source": "https://github.com/dompdf/php-font-lib/tree/1.0.0" + "source": "https://github.com/dompdf/php-font-lib/tree/1.0.1" }, "install-path": "../dompdf/php-font-lib" }, @@ -236,30 +236,30 @@ }, { "name": "sabberworm/php-css-parser", - "version": "v8.5.1", - "version_normalized": "8.5.1.0", + "version": "v8.7.0", + "version_normalized": "8.7.0.0", "source": { "type": "git", "url": "https://github.com/MyIntervals/PHP-CSS-Parser.git", - "reference": "4a3d572b0f8b28bb6fd016ae8bbfc445facef152" + "reference": "f414ff953002a9b18e3a116f5e462c56f21237cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/4a3d572b0f8b28bb6fd016ae8bbfc445facef152", - "reference": "4a3d572b0f8b28bb6fd016ae8bbfc445facef152", + "url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/f414ff953002a9b18e3a116f5e462c56f21237cf", + "reference": "f414ff953002a9b18e3a116f5e462c56f21237cf", "shasum": "" }, "require": { "ext-iconv": "*", - "php": ">=5.6.20" + "php": "^5.6.20 || ^7.0.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.27" + "phpunit/phpunit": "5.7.27 || 6.5.14 || 7.5.20 || 8.5.40" }, "suggest": { "ext-mbstring": "for parsing UTF-8 CSS" }, - "time": "2024-02-15T16:41:13+00:00", + "time": "2024-10-27T17:38:32+00:00", "type": "library", "extra": { "branch-alias": { @@ -298,7 +298,7 @@ ], "support": { "issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues", - "source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.5.1" + "source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v8.7.0" }, "install-path": "../sabberworm/php-css-parser" } diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index a790f08..51d0d60 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '8c099f7f1ac0f97afce9ebcea296c2a618e91f7f', + 'reference' => 'fd02b257104df5e4bc7e4ef84eac9e9bfc77747e', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,25 +13,25 @@ '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '8c099f7f1ac0f97afce9ebcea296c2a618e91f7f', + 'reference' => 'fd02b257104df5e4bc7e4ef84eac9e9bfc77747e', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => false, ), 'dompdf/dompdf' => array( - 'pretty_version' => 'v3.0.0', - 'version' => '3.0.0.0', - 'reference' => 'fbc7c5ee5d94f7a910b78b43feb7931b7f971b59', + 'pretty_version' => 'v3.0.2', + 'version' => '3.0.2.0', + 'reference' => 'baf4084b27c7f4b5b7a221b19a94d11327664eb8', 'type' => 'library', 'install_path' => __DIR__ . '/../dompdf/dompdf', 'aliases' => array(), 'dev_requirement' => false, ), 'dompdf/php-font-lib' => array( - 'pretty_version' => '1.0.0', - 'version' => '1.0.0.0', - 'reference' => '991d6a954f6bbd7e41022198f00586b230731441', + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'reference' => '6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d', 'type' => 'library', 'install_path' => __DIR__ . '/../dompdf/php-font-lib', 'aliases' => array(), @@ -56,9 +56,9 @@ 'dev_requirement' => false, ), 'sabberworm/php-css-parser' => array( - 'pretty_version' => 'v8.5.1', - 'version' => '8.5.1.0', - 'reference' => '4a3d572b0f8b28bb6fd016ae8bbfc445facef152', + 'pretty_version' => 'v8.7.0', + 'version' => '8.7.0.0', + 'reference' => 'f414ff953002a9b18e3a116f5e462c56f21237cf', 'type' => 'library', 'install_path' => __DIR__ . '/../sabberworm/php-css-parser', 'aliases' => array(), diff --git a/vendor/dompdf/dompdf/README.md b/vendor/dompdf/dompdf/README.md index bdde404..c012017 100644 --- a/vendor/dompdf/dompdf/README.md +++ b/vendor/dompdf/dompdf/README.md @@ -98,7 +98,6 @@ Make sure that the autoload file from Composer is loaded. // somewhere early in your project's loading, require the Composer autoloader // see: http://getcomposer.org/doc/00-intro.md require 'vendor/autoload.php'; - ``` ### Download and install @@ -151,6 +150,12 @@ git checkout 8.1.0 Require dompdf and it's dependencies in your PHP. For details see the [autoloader in the utils project](https://github.com/dompdf/utils/blob/master/autoload.inc.php). +## Framework Integration + +* For Symfony: [nucleos/dompdf-bundle](https://github.com/nucleos/NucleosDompdfBundle) +* For Laravel: [barryvdh/laravel-dompdf](https://github.com/barryvdh/laravel-dompdf) +* For Redaxo: [PdfOut](https://github.com/FriendsOfREDAXO/pdfout) + ## Quick Start Just pass your HTML in to dompdf and stream the output: diff --git a/vendor/dompdf/dompdf/VERSION b/vendor/dompdf/dompdf/VERSION index 4a36342..b502146 100644 --- a/vendor/dompdf/dompdf/VERSION +++ b/vendor/dompdf/dompdf/VERSION @@ -1 +1 @@ -3.0.0 +3.0.2 diff --git a/vendor/dompdf/dompdf/composer.json b/vendor/dompdf/dompdf/composer.json index 1c36a28..907b33c 100644 --- a/vendor/dompdf/dompdf/composer.json +++ b/vendor/dompdf/dompdf/composer.json @@ -35,7 +35,7 @@ "ext-gd": "*", "ext-json": "*", "ext-zip": "*", - "phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10", + "phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11", "squizlabs/php_codesniffer": "^3.5", "mockery/mockery": "^1.3", "symfony/process": "^4.4 || ^5.4 || ^6.2 || ^7.0" diff --git a/vendor/dompdf/dompdf/lib/Cpdf.php b/vendor/dompdf/dompdf/lib/Cpdf.php index 1ff5ab4..addd439 100644 --- a/vendor/dompdf/dompdf/lib/Cpdf.php +++ b/vendor/dompdf/dompdf/lib/Cpdf.php @@ -3531,14 +3531,14 @@ private function openFont($font) */ function selectFont($fontName, $encoding = '', $set = true, $isSubsetting = true) { - if ($fontName === null || $fontName === '') { - return $this->currentFontNum; - } - + $fontName = (string) $fontName; $ext = substr($fontName, -4); if ($ext === '.afm' || $ext === '.ufm') { $fontName = substr($fontName, 0, mb_strlen($fontName) - 4); } + if ($fontName === '') { + return $this->currentFontNum; + } if (!isset($this->fonts[$fontName])) { $this->addMessage("selectFont: selecting - $fontName - $encoding, $set"); diff --git a/vendor/dompdf/dompdf/phpunit.xml b/vendor/dompdf/dompdf/phpunit.xml new file mode 100644 index 0000000..7233032 --- /dev/null +++ b/vendor/dompdf/dompdf/phpunit.xml @@ -0,0 +1,20 @@ + + + + + tests + + + diff --git a/vendor/dompdf/dompdf/src/Css/Style.php b/vendor/dompdf/dompdf/src/Css/Style.php index 75c688f..bcaf164 100644 --- a/vendor/dompdf/dompdf/src/Css/Style.php +++ b/vendor/dompdf/dompdf/src/Css/Style.php @@ -2206,7 +2206,7 @@ protected function _get_background_color($computed) */ protected function _get_background_image($computed): string { - return $this->_stylesheet->resolve_url($computed); + return $this->_stylesheet->resolve_url($computed, true); } /** @@ -2504,7 +2504,7 @@ protected function _get_outline(): string */ protected function _get_list_style_image($computed): string { - return $this->_stylesheet->resolve_url($computed); + return $this->_stylesheet->resolve_url($computed, true); } /** diff --git a/vendor/dompdf/dompdf/src/Css/Stylesheet.php b/vendor/dompdf/dompdf/src/Css/Stylesheet.php index 4f29084..e6220d5 100644 --- a/vendor/dompdf/dompdf/src/Css/Stylesheet.php +++ b/vendor/dompdf/dompdf/src/Css/Stylesheet.php @@ -119,6 +119,13 @@ class Stylesheet */ private $_styles; + /** + * Array of embedded files (dataURIs) found in the parsed CSS + * + * @var array + */ + private $_blobs; + /** * Base protocol of the document being parsed * Used to handle relative urls. @@ -995,7 +1002,7 @@ function apply_styles(FrameTree $tree) $single = count($content) === 1 ? $content[0] : null; if ($single instanceof Url) { - $src = $this->resolve_url("url($single->url)"); + $src = $this->resolve_url("url($single->url)", true); $new_node = $node->ownerDocument->createElement("img_generated"); $new_node->setAttribute("src", $src); } else { @@ -1224,8 +1231,6 @@ function apply_styles(FrameTree $tree) * Called by {@link Stylesheet::parse_css()} * * @param string $str - * - * @throws Exception */ private function _parse_css($str) { @@ -1283,8 +1288,23 @@ private function _parse_css($str) /isx EOL; - if (preg_match_all($re, $css, $matches, PREG_SET_ORDER) === false) { - throw new Exception("Error parsing css file: preg_match_all() failed."); + // replace data URIs with blob URIs + while (($start = strpos($css, "data:")) !== false) { + $len = null; + if (preg_match("/['\"\)]/", $css, $matches, PREG_OFFSET_CAPTURE, $start)) { + $len = $matches[0][1] - $start; + } + $data_uri = substr($css, $start, $len); + $data_uri_hash = md5($data_uri); + $this->_blobs[$data_uri_hash] = $data_uri; + $css = substr($css, 0, $start) . "blob://" . $data_uri_hash . ($len > 0 ? substr($css, $start + $len) : ""); + } + + $matches = []; + if (preg_match_all($re, $css, $matches, PREG_SET_ORDER) === false || count($matches) === 0) { + global $_dompdf_warnings; + $_dompdf_warnings[] = "Unable to parse CSS that starts with: " . substr($str, 0, 100); + return; } $media_query_regex = "/{$pattern_media_query}/isx"; @@ -1406,10 +1426,11 @@ private function _parse_css($str) * Resolve the given `url()` declaration to an absolute URL. * * @param string|null $val The declaration to resolve in the context of the stylesheet. - * @return string The resolved URL, or `none`, if the value is `none`, - * invalid, or points to a non-existent local file. + * @param bool|null $resolve_blobs Indicates whether or not to resolve blob URLs to their final value. + * @return string The resolved URL, or `none`, if the value is `none`, + * invalid, or points to a non-existent local file. */ - public function resolve_url($val): string + public function resolve_url($val, $resolve_blobs = false): string { $DEBUGCSS = $this->_dompdf->getOptions()->getDebugCss(); @@ -1430,6 +1451,9 @@ public function resolve_url($val): string $url = str_replace(["\\(", "\\)"], ["(", ")"], $url); break; } + if ($resolve_blobs === true && strpos($url, "blob://") !== false) { + $url = $this->_blobs[substr($url, 7)]; + } $path = Helpers::build_url( $this->_protocol, $this->_base_host, @@ -1463,7 +1487,7 @@ private function _parse_import($url, $import_media_query) if (mb_strpos($url, "url(") === false) { $url = "url($url)"; } - if (($url = $this->resolve_url($url)) === "none") { + if (($url = $this->resolve_url($url, true)) === "none") { return; } @@ -1577,16 +1601,16 @@ private function _parse_font_face($str) $valid_sources = []; foreach ($sources as $source) { - $url_value = $source["CSS_URL_FN_VALUE"] ?? ""; + $urlfn = $source["CSS_URL_FN"] ?? ""; $format = strtolower($source["CSS_STRING_VALUE"] ?? $source["FORMAT_VALUE"] ?? "truetype"); - if ($url_value !== "" && $format === "truetype") { - $url = Helpers::build_url($this->_protocol, $this->_base_host, $this->_base_path, $url_value); - if ($url === null) { + if ($urlfn !== "" && $format === "truetype") { + $url = $this->resolve_url($urlfn, true); + if ($url === "none") { continue; } $source_info = [ - "uri" => $url_value, + "uri" => $urlfn, "format" => $format, "path" => $url, ]; @@ -1628,17 +1652,36 @@ private function _parse_properties($str) print '[_parse_properties'; } - // Split on non-escaped semicolons which are not part of an unquoted - // `url()` declaration. Semicolons in strings are not detected here, and - // as a consequence, should be escaped if used in a string - $urlEnd = "(?> (\\\\[\"'()] | [^\"'()])* ) (? '"', "'" => "'", '(' => ')']; + $delim = null; + $len = strlen($str); + $properties = []; + $char = null; + $prev = null; + for ($pos = 0; $pos < $len; $pos++) { + $prev = $char; + $char = $str[$pos]; + if ($delim !== null) { + if ($char === $delims[$delim] && $prev !== '\\') { + $delim = null; + } + continue; + } + if (isset($delims[$char]) && $prev !== '\\') { + $delim = $char; + continue; + } + if ($char === ';' && $prev !== '\\') { + $properties[] = substr($str, 0, $pos); + $str = substr($str, $pos+1); + $pos = 0; + $len = strlen($str); + } + } + $properties[] = $str; $style = new Style($this, Stylesheet::ORIG_AUTHOR); - foreach ($properties as $prop) { - // Instead of short code with `preg_match`, prefer the typical case - // with fast code - $prop = trim($prop); + $prop = str_replace("\\;", ";", trim($prop)); if ($prop === "") { continue; } diff --git a/vendor/dompdf/dompdf/src/Frame.php b/vendor/dompdf/dompdf/src/Frame.php index 53fedea..20a33b7 100644 --- a/vendor/dompdf/dompdf/src/Frame.php +++ b/vendor/dompdf/dompdf/src/Frame.php @@ -50,14 +50,14 @@ class Frame /** * This frame's calculated style * - * @var Style + * @var Style|null */ protected $_style; /** * This frame's parent in the document tree. * - * @var Frame + * @var Frame|null */ protected $_parent; @@ -65,28 +65,28 @@ class Frame * This frame's first child. All children are handled as a * doubly-linked list. * - * @var Frame + * @var Frame|null */ protected $_first_child; /** * This frame's last child. * - * @var Frame + * @var Frame|null */ protected $_last_child; /** * This frame's previous sibling in the document tree. * - * @var Frame + * @var Frame|null */ protected $_prev_sibling; /** * This frame's next sibling in the document tree. * - * @var Frame + * @var Frame|null */ protected $_next_sibling; diff --git a/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php b/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php index 14aca72..f1b4874 100644 --- a/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php +++ b/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php @@ -897,7 +897,7 @@ final function move(float $offset_x, float $offset_y, bool $ignore_self = false) /** * @param Block|null $block */ - final function reflow(Block $block = null) + final function reflow(?Block $block = null) { // Uncomment this to see the frames before they're laid out, instead of // during rendering. diff --git a/vendor/dompdf/dompdf/src/FrameReflower/AbstractFrameReflower.php b/vendor/dompdf/dompdf/src/FrameReflower/AbstractFrameReflower.php index cd77288..4e318a2 100644 --- a/vendor/dompdf/dompdf/src/FrameReflower/AbstractFrameReflower.php +++ b/vendor/dompdf/dompdf/src/FrameReflower/AbstractFrameReflower.php @@ -294,7 +294,7 @@ protected function position_relative(AbstractFrameDecorator $frame): void /** * @param Block|null $block */ - abstract function reflow(Block $block = null); + abstract function reflow(?Block $block = null); /** * Resolve the `min-width` property. diff --git a/vendor/dompdf/dompdf/src/FrameReflower/Block.php b/vendor/dompdf/dompdf/src/FrameReflower/Block.php index 1eda610..45db9fd 100644 --- a/vendor/dompdf/dompdf/src/FrameReflower/Block.php +++ b/vendor/dompdf/dompdf/src/FrameReflower/Block.php @@ -776,9 +776,9 @@ function process_float(AbstractFrameDecorator $child, $cb_x, $cb_w) } /** - * @param BlockFrameDecorator $block + * @param BlockFrameDecorator|null $block */ - function reflow(BlockFrameDecorator $block = null) + function reflow(?BlockFrameDecorator $block = null) { // Check if a page break is forced diff --git a/vendor/dompdf/dompdf/src/FrameReflower/Image.php b/vendor/dompdf/dompdf/src/FrameReflower/Image.php index eae3408..42618f6 100644 --- a/vendor/dompdf/dompdf/src/FrameReflower/Image.php +++ b/vendor/dompdf/dompdf/src/FrameReflower/Image.php @@ -30,7 +30,7 @@ function __construct(ImageFrameDecorator $frame) /** * @param BlockFrameDecorator|null $block */ - function reflow(BlockFrameDecorator $block = null) + function reflow(?BlockFrameDecorator $block = null) { $this->determine_absolute_containing_block(); diff --git a/vendor/dompdf/dompdf/src/FrameReflower/Inline.php b/vendor/dompdf/dompdf/src/FrameReflower/Inline.php index 5091afd..d31fa45 100644 --- a/vendor/dompdf/dompdf/src/FrameReflower/Inline.php +++ b/vendor/dompdf/dompdf/src/FrameReflower/Inline.php @@ -74,7 +74,7 @@ protected function reflow_empty(BlockFrameDecorator $block): void /** * @param BlockFrameDecorator|null $block */ - function reflow(BlockFrameDecorator $block = null) + function reflow(?BlockFrameDecorator $block = null) { /** @var InlineFrameDecorator */ $frame = $this->_frame; diff --git a/vendor/dompdf/dompdf/src/FrameReflower/ListBullet.php b/vendor/dompdf/dompdf/src/FrameReflower/ListBullet.php index 3618a28..c7141ab 100644 --- a/vendor/dompdf/dompdf/src/FrameReflower/ListBullet.php +++ b/vendor/dompdf/dompdf/src/FrameReflower/ListBullet.php @@ -29,7 +29,7 @@ function __construct(ListBulletFrameDecorator $frame) /** * @param BlockFrameDecorator|null $block */ - function reflow(BlockFrameDecorator $block = null) + function reflow(?BlockFrameDecorator $block = null) { if ($block === null) { return; diff --git a/vendor/dompdf/dompdf/src/FrameReflower/NullFrameReflower.php b/vendor/dompdf/dompdf/src/FrameReflower/NullFrameReflower.php index 8d7e558..0159b1e 100644 --- a/vendor/dompdf/dompdf/src/FrameReflower/NullFrameReflower.php +++ b/vendor/dompdf/dompdf/src/FrameReflower/NullFrameReflower.php @@ -29,7 +29,7 @@ function __construct(Frame $frame) /** * @param BlockFrameDecorator|null $block */ - function reflow(BlockFrameDecorator $block = null) + function reflow(?BlockFrameDecorator $block = null) { return; } diff --git a/vendor/dompdf/dompdf/src/FrameReflower/Page.php b/vendor/dompdf/dompdf/src/FrameReflower/Page.php index 923865b..38e2ea3 100644 --- a/vendor/dompdf/dompdf/src/FrameReflower/Page.php +++ b/vendor/dompdf/dompdf/src/FrameReflower/Page.php @@ -91,7 +91,7 @@ function apply_page_style(Frame $frame, $page_number) * * @param BlockFrameDecorator|null $block */ - function reflow(BlockFrameDecorator $block = null) + function reflow(?BlockFrameDecorator $block = null) { /** @var PageFrameDecorator $frame */ $frame = $this->_frame; diff --git a/vendor/dompdf/dompdf/src/FrameReflower/Table.php b/vendor/dompdf/dompdf/src/FrameReflower/Table.php index 5173738..707d18f 100644 --- a/vendor/dompdf/dompdf/src/FrameReflower/Table.php +++ b/vendor/dompdf/dompdf/src/FrameReflower/Table.php @@ -296,7 +296,7 @@ protected function _calculate_height() /** * @param BlockFrameDecorator|null $block */ - function reflow(BlockFrameDecorator $block = null) + function reflow(?BlockFrameDecorator $block = null) { /** @var TableFrameDecorator */ $frame = $this->_frame; diff --git a/vendor/dompdf/dompdf/src/FrameReflower/TableCell.php b/vendor/dompdf/dompdf/src/FrameReflower/TableCell.php index bbc60b1..e63029f 100644 --- a/vendor/dompdf/dompdf/src/FrameReflower/TableCell.php +++ b/vendor/dompdf/dompdf/src/FrameReflower/TableCell.php @@ -31,7 +31,7 @@ function __construct(BlockFrameDecorator $frame) /** * @param BlockFrameDecorator|null $block */ - function reflow(BlockFrameDecorator $block = null) + function reflow(?BlockFrameDecorator $block = null) { /** @var TableCellFrameDecorator */ $frame = $this->_frame; diff --git a/vendor/dompdf/dompdf/src/FrameReflower/TableRow.php b/vendor/dompdf/dompdf/src/FrameReflower/TableRow.php index 76ac13f..5115a24 100644 --- a/vendor/dompdf/dompdf/src/FrameReflower/TableRow.php +++ b/vendor/dompdf/dompdf/src/FrameReflower/TableRow.php @@ -30,7 +30,7 @@ function __construct(TableRowFrameDecorator $frame) /** * @param BlockFrameDecorator|null $block */ - function reflow(BlockFrameDecorator $block = null) + function reflow(?BlockFrameDecorator $block = null) { /** @var TableRowFrameDecorator */ $frame = $this->_frame; diff --git a/vendor/dompdf/dompdf/src/FrameReflower/TableRowGroup.php b/vendor/dompdf/dompdf/src/FrameReflower/TableRowGroup.php index 5745a73..20f5ee6 100644 --- a/vendor/dompdf/dompdf/src/FrameReflower/TableRowGroup.php +++ b/vendor/dompdf/dompdf/src/FrameReflower/TableRowGroup.php @@ -31,7 +31,7 @@ function __construct(TableRowGroupFrameDecorator $frame) /** * @param BlockFrameDecorator|null $block */ - function reflow(BlockFrameDecorator $block = null) + function reflow(?BlockFrameDecorator $block = null) { /** @var TableRowGroupFrameDecorator */ $frame = $this->_frame; diff --git a/vendor/dompdf/dompdf/src/FrameReflower/Text.php b/vendor/dompdf/dompdf/src/FrameReflower/Text.php index 2d71ea5..208c012 100644 --- a/vendor/dompdf/dompdf/src/FrameReflower/Text.php +++ b/vendor/dompdf/dompdf/src/FrameReflower/Text.php @@ -381,7 +381,7 @@ protected function layout_line(BlockFrameDecorator $block): ?bool * @param BlockFrameDecorator|null $block * @throws Exception */ - function reflow(BlockFrameDecorator $block = null) + function reflow(?BlockFrameDecorator $block = null) { $frame = $this->_frame; $page = $frame->get_root(); diff --git a/vendor/dompdf/dompdf/src/Helpers.php b/vendor/dompdf/dompdf/src/Helpers.php index b0fe8f7..9352b4e 100644 --- a/vendor/dompdf/dompdf/src/Helpers.php +++ b/vendor/dompdf/dompdf/src/Helpers.php @@ -579,7 +579,7 @@ public static function dompdf_debug($type, $msg) public static function record_warnings($errno, $errstr, $errfile, $errline) { // Not a warning or notice - if (!($errno & (E_WARNING | E_NOTICE | E_USER_NOTICE | E_USER_WARNING | E_STRICT | E_DEPRECATED | E_USER_DEPRECATED))) { + if (!($errno & (E_WARNING | E_NOTICE | E_USER_NOTICE | E_USER_WARNING | E_DEPRECATED | E_USER_DEPRECATED))) { throw new Exception($errstr . " $errno"); } @@ -599,10 +599,10 @@ public static function record_warnings($errno, $errstr, $errfile, $errline) * Shim for use on systems running PHP < 7.2 * * @param string $c - * @param string $encoding + * @param string|null $encoding * @return int|false */ - public static function uniord(string $c, string $encoding = null) + public static function uniord(string $c, ?string $encoding = null) { if (function_exists("mb_ord")) { if (PHP_VERSION_ID < 80000 && $encoding === null) { @@ -675,10 +675,10 @@ public static function uniord(string $c, string $encoding = null) * Shim for use on systems running PHP < 7.2 * * @param int $c - * @param string $encoding + * @param string|null $encoding * @return string|false */ - public static function unichr(int $c, string $encoding = null) + public static function unichr(int $c, ?string $encoding = null) { if (function_exists("mb_chr")) { if (PHP_VERSION_ID < 80000 && $encoding === null) { diff --git a/vendor/dompdf/dompdf/src/Image/Cache.php b/vendor/dompdf/dompdf/src/Image/Cache.php index b3e1d0e..b9fd322 100644 --- a/vendor/dompdf/dompdf/src/Image/Cache.php +++ b/vendor/dompdf/dompdf/src/Image/Cache.php @@ -168,7 +168,7 @@ function ($parser, $name, $attributes) use ($options, $parsed_url, $full_url) { } } }, - false + null ); if (($fp = fopen($resolved_url, "r")) !== false) { diff --git a/vendor/dompdf/dompdf/src/Options.php b/vendor/dompdf/dompdf/src/Options.php index 4d5e161..8d0b7bd 100644 --- a/vendor/dompdf/dompdf/src/Options.php +++ b/vendor/dompdf/dompdf/src/Options.php @@ -71,7 +71,7 @@ class Options * Protocol whitelist * * Protocols and PHP wrappers allowed in URIs, and the validation rules - * that determine if a resouce may be loaded. Full support is not guaranteed + * that determine if a resource may be loaded. Full support is not guaranteed * for the protocols/wrappers specified * by this array. * @@ -93,7 +93,7 @@ class Options /** * @var string */ - private $logOutputFile; + private $logOutputFile = ''; /** * Styles targeted to this media type are applied to the document. @@ -330,7 +330,7 @@ class Options /** * @param array $attributes */ - public function __construct(array $attributes = null) + public function __construct(?array $attributes = null) { $rootDir = realpath(__DIR__ . "/../"); $this->setChroot(array($rootDir)); diff --git a/vendor/dompdf/php-font-lib/src/FontLib/TrueType/File.php b/vendor/dompdf/php-font-lib/src/FontLib/TrueType/File.php index ee3c84e..f4c797a 100644 --- a/vendor/dompdf/php-font-lib/src/FontLib/TrueType/File.php +++ b/vendor/dompdf/php-font-lib/src/FontLib/TrueType/File.php @@ -100,7 +100,7 @@ class File extends BinaryStream { "Ccaron", "ccaron", "dmacron" ); - private function uniord (string $c, string $encoding = null) { + private function uniord (string $c, ?string $encoding = null) { if (function_exists("mb_ord")) { if (PHP_VERSION_ID < 80000 && $encoding === null) { // in PHP < 8 the encoding argument, if supplied, must be a valid encoding diff --git a/vendor/sabberworm/php-css-parser/CHANGELOG.md b/vendor/sabberworm/php-css-parser/CHANGELOG.md index 302cf1d..c90927c 100644 --- a/vendor/sabberworm/php-css-parser/CHANGELOG.md +++ b/vendor/sabberworm/php-css-parser/CHANGELOG.md @@ -15,10 +15,55 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Fixed +## 8.7.0: Add support for PHP 8.4 + +### Added + +- Add support for PHP 8.4 (#675, #701, #746, #751) + +### Changed + +- Mark parsing-internal classes and methods as `@internal` (#711) +- Block installations on unsupported higher PHP versions (#691) + +### Deprecated + +- Deprecate the expansion of shorthand properties (#719) +- Deprecate `Parser::setCharset()` and `Parser::getCharset()` (#703) + +### Fixed + +- Fix type errors in PHP strict mode (#695) + +## 8.6.0 + +### Added + +- Support arithmetic operators in CSS function arguments (#607) +- Add support for inserting an item in a CSS list (#545) +- Add support for the `dvh`, `lvh` and `svh` length units (#415) + +### Changed + +- Improve performance of Value::parseValue with many delimiters by refactoring + to remove `array_search()` (#413) + +## 8.5.2 + +### Changed + +- Mark all class constants as `@internal` (#500) + +### Fixed + +- Fix undefined local variable in `CalcFunction::parse()` (#593) + ## 8.5.1 ### Fixed +- Fix PHP notice caused by parsing invalid color values having less than + 6 characters (#485) - Fix (regression) failure to parse at-rules with strict parsing (#456) ## 8.5.0 @@ -43,7 +88,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). * Support for PHP 8.x * PHPDoc annotations -* Allow usage of CSS variables inside color functions (by parsing them as regular functions) +* Allow usage of CSS variables inside color functions (by parsing them as + regular functions) * Use PSR-12 code style * *No deprecations* @@ -58,7 +104,10 @@ This project adheres to [Semantic Versioning](https://semver.org/). * Allow a file to end after an `@import` * Preserve case of CSS variables as specced * Allow identifiers to use escapes the same way as strings -* No longer use `eval` for the comparison in `getSelectorsBySpecificity`, in case it gets passed untrusted input (CVE-2020-13756). Also fixed in 8.3.1, 8.2.1, 8.1.1, 8.0.1, 7.0.4, 6.0.2, 5.2.1, 5.1.3, 5.0.9, 4.0.1, 3.0.1, 2.0.1, 1.0.1. +* No longer use `eval` for the comparison in `getSelectorsBySpecificity`, in + case it gets passed untrusted input (CVE-2020-13756). Also fixed in 8.3.1, + 8.2.1, 8.1.1, 8.0.1, 7.0.4, 6.0.2, 5.2.1, 5.1.3, 5.0.9, 4.0.1, 3.0.1, 2.0.1, + 1.0.1. * Prevent an infinite loop when parsing invalid grid line names * Remove invalid unit `vm` * Retain rule order after expanding shorthands @@ -70,11 +119,16 @@ This project adheres to [Semantic Versioning](https://semver.org/). ## 8.3.0 (2019-02-22) -* Refactor parsing logic to mostly reside in the class files whose data structure is to be parsed (this should eventually allow us to unit-test specific parts of the parsing logic individually). -* Fix error in parsing `calc` expessions when the first operand is a negative number, thanks to @raxbg. -* Support parsing CSS4 colors in hex notation with alpha values, thanks to @raxbg. +* Refactor parsing logic to mostly reside in the class files whose data + structure is to be parsed (this should eventually allow us to unit-test + specific parts of the parsing logic individually). +* Fix error in parsing `calc` expessions when the first operand is a negative + number, thanks to @raxbg. +* Support parsing CSS4 colors in hex notation with alpha values, thanks to + @raxbg. * Swallow more errors in lenient mode, thanks to @raxbg. -* Allow specifying arbitrary strings to output before and after declaration blocks, thanks to @westonruter. +* Allow specifying arbitrary strings to output before and after declaration + blocks, thanks to @westonruter. * *No backwards-incompatible changes* * *No deprecations* @@ -82,16 +136,20 @@ This project adheres to [Semantic Versioning](https://semver.org/). * Support parsing `calc()`, thanks to @raxbg. * Support parsing grid-lines, again thanks to @raxbg. -* Support parsing legacy IE filters (`progid:`) in lenient mode, thanks to @FMCorz +* Support parsing legacy IE filters (`progid:`) in lenient mode, thanks to + @FMCorz * Performance improvements parsing large files, again thanks to @FMCorz * *No backwards-incompatible changes* * *No deprecations* ## 8.1.0 (2016-07-19) -* Comments are no longer silently ignored but stored with the object with which they appear (no render support, though). Thanks to @FMCorz. -* The IE hacks using `\0` and `\9` can now be parsed (and rendered) in lenient mode. Thanks (again) to @FMCorz. -* Media queries with or without spaces before the query are parsed. Still no *real* parsing support, though. Sorry… +* Comments are no longer silently ignored but stored with the object with which + they appear (no render support, though). Thanks to @FMCorz. +* The IE hacks using `\0` and `\9` can now be parsed (and rendered) in lenient + mode. Thanks (again) to @FMCorz. +* Media queries with or without spaces before the query are parsed. Still no + *real* parsing support, though. Sorry… * PHPUnit is now listed as a dev-dependency in composer.json. * *No backwards-incompatible changes* * *No deprecations* @@ -103,7 +161,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Backwards-incompatible changes -* Unrecoverable parser errors throw an exception of type `Sabberworm\CSS\Parsing\SourceException` instead of `\Exception`. +* Unrecoverable parser errors throw an exception of type + `Sabberworm\CSS\Parsing\SourceException` instead of `\Exception`. ## 7.0.3 (2016-04-27) @@ -113,7 +172,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). ## 7.0.2 (2016-02-11) -* 150 time performance boost thanks to @[ossinkine](https://github.com/ossinkine) +* 150 time performance boost thanks + to @[ossinkine](https://github.com/ossinkine) * *No backwards-incompatible changes* * *No deprecations* @@ -130,7 +190,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Backwards-incompatible changes -* The `Sabberworm\CSS\Value\String` class has been renamed to `Sabberworm\CSS\Value\CSSString`. +* The `Sabberworm\CSS\Value\String` class has been renamed to + `Sabberworm\CSS\Value\CSSString`. ## 6.0.1 (2015-08-24) @@ -144,22 +205,27 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Deprecations -* The parse() method replaces __toString with an optional argument (instance of the OutputFormat class) +* The parse() method replaces __toString with an optional argument (instance of + the OutputFormat class) ## 5.2.0 (2014-06-30) -* Support removing a selector from a declaration block using `$oBlock->removeSelector($mSelector)` -* Introduce a specialized exception (Sabberworm\CSS\Parsing\OuputException) for exceptions during output rendering +* Support removing a selector from a declaration block using + `$oBlock->removeSelector($mSelector)` +* Introduce a specialized exception (Sabberworm\CSS\Parsing\OuputException) for + exceptions during output rendering * *No deprecations* #### Backwards-incompatible changes -* Outputting a declaration block that has no selectors throws an OuputException instead of outputting an invalid ` {…}` into the CSS document. +* Outputting a declaration block that has no selectors throws an OuputException + instead of outputting an invalid ` {…}` into the CSS document. ## 5.1.2 (2013-10-30) -* Remove the use of consumeUntil in comment parsing. This makes it possible to parse comments such as `/** Perfectly valid **/` +* Remove the use of consumeUntil in comment parsing. This makes it possible to + parse comments such as `/** Perfectly valid **/` * Add fr relative size unit * Fix some issues with HHVM * *No backwards-incompatible changes* @@ -174,13 +240,15 @@ This project adheres to [Semantic Versioning](https://semver.org/). ## 5.1.0 (2013-10-24) * Performance enhancements by Michael M Slusarz -* More rescue entry points for lenient parsing (unexpected tokens between declaration blocks and unclosed comments) +* More rescue entry points for lenient parsing (unexpected tokens between + declaration blocks and unclosed comments) * *No backwards-incompatible changes* * *No deprecations* ## 5.0.8 (2013-08-15) -* Make default settings’ multibyte parsing option dependent on whether or not the mbstring extension is actually installed. +* Make default settings’ multibyte parsing option dependent on whether or not + the mbstring extension is actually installed. * *No backwards-incompatible changes* * *No deprecations* @@ -198,7 +266,9 @@ This project adheres to [Semantic Versioning](https://semver.org/). ## 5.0.5 (2013-04-17) -* Initial support for lenient parsing (setting this parser option will catch some exceptions internally and recover the parser’s state as neatly as possible). +* Initial support for lenient parsing (setting this parser option will catch + some exceptions internally and recover the parser’s state as neatly as + possible). * *No backwards-incompatible changes* * *No deprecations* @@ -235,18 +305,22 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Backwards-incompatible changes -* `Sabberworm\CSS\Value\Color`’s `__toString` method overrides `CSSList`’s to maybe return something other than `type(value, …)` (see above). +* `Sabberworm\CSS\Value\Color`’s `__toString` method overrides `CSSList`’s to + maybe return something other than `type(value, …)` (see above). ## 4.0.0 (2013-03-19) * Support for more @-rules -* Generic interface `Sabberworm\CSS\Property\AtRule`, implemented by all @-rule classes +* Generic interface `Sabberworm\CSS\Property\AtRule`, implemented by all @-rule + classes * *No deprecations* ### Backwards-incompatible changes * `Sabberworm\CSS\RuleSet\AtRule` renamed to `Sabberworm\CSS\RuleSet\AtRuleSet` -* `Sabberworm\CSS\CSSList\MediaQuery` renamed to `Sabberworm\CSS\RuleSet\CSSList\AtRuleBlockList` with differing semantics and API (which also works for other block-list-based @-rules like `@supports`). +* `Sabberworm\CSS\CSSList\MediaQuery` renamed to + `Sabberworm\CSS\RuleSet\CSSList\AtRuleBlockList` with differing semantics and + API (which also works for other block-list-based @-rules like `@supports`). ## 3.0.0 (2013-03-06) @@ -255,10 +329,18 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Backwards-incompatible changes -* All properties (like whether or not to use `mb_`-functions, which default charset to use and – new – whether or not to be forgiving when parsing) are now encapsulated in an instance of `Sabberworm\CSS\Settings` which can be passed as the second argument to `Sabberworm\CSS\Parser->__construct()`. -* Specifying a charset as the second argument to `Sabberworm\CSS\Parser->__construct()` is no longer supported. Use `Sabberworm\CSS\Settings::create()->withDefaultCharset('some-charset')` instead. -* Setting `Sabberworm\CSS\Parser->bUseMbFunctions` has no effect. Use `Sabberworm\CSS\Settings::create()->withMultibyteSupport(true/false)` instead. -* `Sabberworm\CSS\Parser->parse()` may throw a `Sabberworm\CSS\Parsing\UnexpectedTokenException` when in strict parsing mode. +* All properties (like whether or not to use `mb_`-functions, which default + charset to use and – new – whether or not to be forgiving when parsing) are + now encapsulated in an instance of `Sabberworm\CSS\Settings` which can be + passed as the second argument to `Sabberworm\CSS\Parser->__construct()`. +* Specifying a charset as the second argument to + `Sabberworm\CSS\Parser->__construct()` is no longer supported. Use + `Sabberworm\CSS\Settings::create()->withDefaultCharset('some-charset')` + instead. +* Setting `Sabberworm\CSS\Parser->bUseMbFunctions` has no effect. Use + `Sabberworm\CSS\Settings::create()->withMultibyteSupport(true/false)` instead. +* `Sabberworm\CSS\Parser->parse()` may throw a + `Sabberworm\CSS\Parsing\UnexpectedTokenException` when in strict parsing mode. ## 2.0.0 (2013-01-29) @@ -266,8 +348,13 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Backwards-incompatible changes -* `Sabberworm\CSS\RuleSet->getRules()` returns an index-based array instead of an associative array. Use `Sabberworm\CSS\RuleSet->getRulesAssoc()` (which eliminates duplicate rules and lets the later rule of the same name win). -* `Sabberworm\CSS\RuleSet->removeRule()` works as it did before except when passed an instance of `Sabberworm\CSS\Rule\Rule`, in which case it would only remove the exact rule given instead of all the rules of the same type. To get the old behaviour, use `Sabberworm\CSS\RuleSet->removeRule($oRule->getRule()`; +* `Sabberworm\CSS\RuleSet->getRules()` returns an index-based array instead of + an associative array. Use `Sabberworm\CSS\RuleSet->getRulesAssoc()` (which + eliminates duplicate rules and lets the later rule of the same name win). +* `Sabberworm\CSS\RuleSet->removeRule()` works as it did before except when + passed an instance of `Sabberworm\CSS\Rule\Rule`, in which case it would only + remove the exact rule given instead of all the rules of the same type. To get + the old behaviour, use `Sabberworm\CSS\RuleSet->removeRule($oRule->getRule()`; ## 1.0 diff --git a/vendor/sabberworm/php-css-parser/composer.json b/vendor/sabberworm/php-css-parser/composer.json index cf15a94..685db65 100644 --- a/vendor/sabberworm/php-css-parser/composer.json +++ b/vendor/sabberworm/php-css-parser/composer.json @@ -23,11 +23,11 @@ } ], "require": { - "php": ">=5.6.20", + "php": "^5.6.20 || ^7.0.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", "ext-iconv": "*" }, "require-dev": { - "phpunit/phpunit": "^5.7.27" + "phpunit/phpunit": "5.7.27 || 6.5.14 || 7.5.20 || 8.5.40" }, "suggest": { "ext-mbstring": "for parsing UTF-8 CSS" diff --git a/vendor/sabberworm/php-css-parser/src/CSSList/AtRuleBlockList.php b/vendor/sabberworm/php-css-parser/src/CSSList/AtRuleBlockList.php index 598fefc..5930b93 100644 --- a/vendor/sabberworm/php-css-parser/src/CSSList/AtRuleBlockList.php +++ b/vendor/sabberworm/php-css-parser/src/CSSList/AtRuleBlockList.php @@ -57,9 +57,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { $sResult = $oOutputFormat->comments($this); $sResult .= $oOutputFormat->sBeforeAtRuleBlock; diff --git a/vendor/sabberworm/php-css-parser/src/CSSList/CSSList.php b/vendor/sabberworm/php-css-parser/src/CSSList/CSSList.php index 603f662..4bb3758 100644 --- a/vendor/sabberworm/php-css-parser/src/CSSList/CSSList.php +++ b/vendor/sabberworm/php-css-parser/src/CSSList/CSSList.php @@ -296,6 +296,22 @@ public function splice($iOffset, $iLength = null, $mReplacement = null) array_splice($this->aContents, $iOffset, $iLength, $mReplacement); } + /** + * Inserts an item in the CSS list before its sibling. If the desired sibling cannot be found, + * the item is appended at the end. + * + * @param RuleSet|CSSList|Import|Charset $item + * @param RuleSet|CSSList|Import|Charset $sibling + */ + public function insertBefore($item, $sibling) + { + if (in_array($sibling, $this->aContents, true)) { + $this->replace($sibling, [$item, $sibling]); + } else { + $this->append($item); + } + } + /** * Removes an item from the CSS list. * diff --git a/vendor/sabberworm/php-css-parser/src/CSSList/Document.php b/vendor/sabberworm/php-css-parser/src/CSSList/Document.php index bad9983..7d9c6ec 100644 --- a/vendor/sabberworm/php-css-parser/src/CSSList/Document.php +++ b/vendor/sabberworm/php-css-parser/src/CSSList/Document.php @@ -128,6 +128,8 @@ public function getSelectorsBySpecificity($sSpecificitySearch = null) * Expands all shorthand properties to their long value. * * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function expandShorthands() { @@ -140,6 +142,8 @@ public function expandShorthands() * Create shorthands properties whenever possible. * * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function createShorthands() { @@ -155,7 +159,7 @@ public function createShorthands() * * @return string */ - public function render(OutputFormat $oOutputFormat = null) + public function render($oOutputFormat = null) { if ($oOutputFormat === null) { $oOutputFormat = new OutputFormat(); diff --git a/vendor/sabberworm/php-css-parser/src/CSSList/KeyFrame.php b/vendor/sabberworm/php-css-parser/src/CSSList/KeyFrame.php index caef7b3..69e2e4d 100644 --- a/vendor/sabberworm/php-css-parser/src/CSSList/KeyFrame.php +++ b/vendor/sabberworm/php-css-parser/src/CSSList/KeyFrame.php @@ -68,9 +68,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { $sResult = $oOutputFormat->comments($this); $sResult .= "@{$this->vendorKeyFrame} {$this->animationName}{$oOutputFormat->spaceBeforeOpeningBrace()}{"; diff --git a/vendor/sabberworm/php-css-parser/src/Comment/Comment.php b/vendor/sabberworm/php-css-parser/src/Comment/Comment.php index 6128d74..e6ffaaf 100644 --- a/vendor/sabberworm/php-css-parser/src/Comment/Comment.php +++ b/vendor/sabberworm/php-css-parser/src/Comment/Comment.php @@ -62,9 +62,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { return '/*' . $this->sComment . '*/'; } diff --git a/vendor/sabberworm/php-css-parser/src/Parser.php b/vendor/sabberworm/php-css-parser/src/Parser.php index e582cfa..f60fc08 100644 --- a/vendor/sabberworm/php-css-parser/src/Parser.php +++ b/vendor/sabberworm/php-css-parser/src/Parser.php @@ -21,7 +21,7 @@ class Parser * @param Settings|null $oParserSettings * @param int $iLineNo the line number (starting from 1, not from 0) */ - public function __construct($sText, Settings $oParserSettings = null, $iLineNo = 1) + public function __construct($sText, $oParserSettings = null, $iLineNo = 1) { if ($oParserSettings === null) { $oParserSettings = Settings::create(); @@ -35,6 +35,8 @@ public function __construct($sText, Settings $oParserSettings = null, $iLineNo = * @param string $sCharset * * @return void + * + * @deprecated since 8.7.0, will be removed in version 9.0.0 with #687 */ public function setCharset($sCharset) { @@ -45,6 +47,8 @@ public function setCharset($sCharset) * Returns the charset that is used if the CSS does not contain an `@charset` declaration. * * @return void + * + * @deprecated since 8.7.0, will be removed in version 9.0.0 with #687 */ public function getCharset() { diff --git a/vendor/sabberworm/php-css-parser/src/Parsing/Anchor.php b/vendor/sabberworm/php-css-parser/src/Parsing/Anchor.php index 93789e2..a42893d 100644 --- a/vendor/sabberworm/php-css-parser/src/Parsing/Anchor.php +++ b/vendor/sabberworm/php-css-parser/src/Parsing/Anchor.php @@ -2,6 +2,9 @@ namespace Sabberworm\CSS\Parsing; +/** + * @internal since 8.7.0 + */ class Anchor { /** diff --git a/vendor/sabberworm/php-css-parser/src/Parsing/ParserState.php b/vendor/sabberworm/php-css-parser/src/Parsing/ParserState.php index 7a99f32..2427c5e 100644 --- a/vendor/sabberworm/php-css-parser/src/Parsing/ParserState.php +++ b/vendor/sabberworm/php-css-parser/src/Parsing/ParserState.php @@ -5,10 +5,15 @@ use Sabberworm\CSS\Comment\Comment; use Sabberworm\CSS\Settings; +/** + * @internal since 8.7.0 + */ class ParserState { /** * @var null + * + * @internal since 8.5.2 */ const EOF = null; diff --git a/vendor/sabberworm/php-css-parser/src/Property/AtRule.php b/vendor/sabberworm/php-css-parser/src/Property/AtRule.php index 9536ff5..d946a90 100644 --- a/vendor/sabberworm/php-css-parser/src/Property/AtRule.php +++ b/vendor/sabberworm/php-css-parser/src/Property/AtRule.php @@ -12,6 +12,8 @@ interface AtRule extends Renderable, Commentable * we’re whitelisting the block rules and have anything else be treated as a set rule. * * @var string + * + * @internal since 8.5.2 */ const BLOCK_RULES = 'media/document/supports/region-style/font-feature-values'; @@ -19,6 +21,8 @@ interface AtRule extends Renderable, Commentable * … and more font-specific ones (to be used inside font-feature-values) * * @var string + * + * @internal since 8.5.2 */ const SET_RULES = 'font-face/counter-style/page/swash/styleset/annotation'; diff --git a/vendor/sabberworm/php-css-parser/src/Property/CSSNamespace.php b/vendor/sabberworm/php-css-parser/src/Property/CSSNamespace.php index 0d7eb49..d1bac4f 100644 --- a/vendor/sabberworm/php-css-parser/src/Property/CSSNamespace.php +++ b/vendor/sabberworm/php-css-parser/src/Property/CSSNamespace.php @@ -60,9 +60,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { return '@namespace ' . ($this->sPrefix === null ? '' : $this->sPrefix . ' ') . $this->mUrl->render($oOutputFormat) . ';'; diff --git a/vendor/sabberworm/php-css-parser/src/Property/Charset.php b/vendor/sabberworm/php-css-parser/src/Property/Charset.php index 26e1b25..870380e 100644 --- a/vendor/sabberworm/php-css-parser/src/Property/Charset.php +++ b/vendor/sabberworm/php-css-parser/src/Property/Charset.php @@ -78,9 +78,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { return "{$oOutputFormat->comments($this)}@charset {$this->oCharset->render($oOutputFormat)};"; } diff --git a/vendor/sabberworm/php-css-parser/src/Property/Import.php b/vendor/sabberworm/php-css-parser/src/Property/Import.php index d715a7a..2a7cad5 100644 --- a/vendor/sabberworm/php-css-parser/src/Property/Import.php +++ b/vendor/sabberworm/php-css-parser/src/Property/Import.php @@ -79,9 +79,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { return $oOutputFormat->comments($this) . "@import " . $this->oLocation->render($oOutputFormat) . ($this->sMediaQuery === null ? '' : ' ' . $this->sMediaQuery) . ';'; diff --git a/vendor/sabberworm/php-css-parser/src/Property/KeyframeSelector.php b/vendor/sabberworm/php-css-parser/src/Property/KeyframeSelector.php index 14ea5eb..2aff8d2 100644 --- a/vendor/sabberworm/php-css-parser/src/Property/KeyframeSelector.php +++ b/vendor/sabberworm/php-css-parser/src/Property/KeyframeSelector.php @@ -8,6 +8,8 @@ class KeyframeSelector extends Selector * regexp for specificity calculations * * @var string + * + * @internal since 8.5.2 */ const SELECTOR_VALIDATION_RX = '/ ^( diff --git a/vendor/sabberworm/php-css-parser/src/Property/Selector.php b/vendor/sabberworm/php-css-parser/src/Property/Selector.php index 70c9b2f..44355e6 100644 --- a/vendor/sabberworm/php-css-parser/src/Property/Selector.php +++ b/vendor/sabberworm/php-css-parser/src/Property/Selector.php @@ -12,6 +12,8 @@ class Selector * regexp for specificity calculations * * @var string + * + * @internal */ const NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX = '/ (\.[\w]+) # classes @@ -36,6 +38,8 @@ class Selector * regexp for specificity calculations * * @var string + * + * @internal */ const ELEMENTS_AND_PSEUDO_ELEMENTS_RX = '/ ((^|[\s\+\>\~]+)[\w]+ # elements @@ -49,6 +53,8 @@ class Selector * regexp for specificity calculations * * @var string + * + * @internal since 8.5.2 */ const SELECTOR_VALIDATION_RX = '/ ^( diff --git a/vendor/sabberworm/php-css-parser/src/Renderable.php b/vendor/sabberworm/php-css-parser/src/Renderable.php index dc1bff3..d7c6aba 100644 --- a/vendor/sabberworm/php-css-parser/src/Renderable.php +++ b/vendor/sabberworm/php-css-parser/src/Renderable.php @@ -10,9 +10,11 @@ interface Renderable public function __toString(); /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat); + public function render($oOutputFormat); /** * @return int diff --git a/vendor/sabberworm/php-css-parser/src/Rule/Rule.php b/vendor/sabberworm/php-css-parser/src/Rule/Rule.php index fc00c88..c1bad65 100644 --- a/vendor/sabberworm/php-css-parser/src/Rule/Rule.php +++ b/vendor/sabberworm/php-css-parser/src/Rule/Rule.php @@ -107,6 +107,7 @@ public static function parse(ParserState $oParserState) while ($oParserState->comes(';')) { $oParserState->consume(';'); } + $oParserState->consumeWhiteSpace(); return $oRule; @@ -343,9 +344,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { $sResult = "{$oOutputFormat->comments($this)}{$this->sRule}:{$oOutputFormat->spaceAfterRuleName()}"; if ($this->mValue instanceof Value) { // Can also be a ValueList diff --git a/vendor/sabberworm/php-css-parser/src/RuleSet/AtRuleSet.php b/vendor/sabberworm/php-css-parser/src/RuleSet/AtRuleSet.php index aab6d79..93fd07a 100644 --- a/vendor/sabberworm/php-css-parser/src/RuleSet/AtRuleSet.php +++ b/vendor/sabberworm/php-css-parser/src/RuleSet/AtRuleSet.php @@ -60,9 +60,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { $sResult = $oOutputFormat->comments($this); $sArgs = $this->sArgs; diff --git a/vendor/sabberworm/php-css-parser/src/RuleSet/DeclarationBlock.php b/vendor/sabberworm/php-css-parser/src/RuleSet/DeclarationBlock.php index b218bd8..8a1da14 100644 --- a/vendor/sabberworm/php-css-parser/src/RuleSet/DeclarationBlock.php +++ b/vendor/sabberworm/php-css-parser/src/RuleSet/DeclarationBlock.php @@ -181,6 +181,8 @@ public function getSelectors() * Splits shorthand declarations (e.g. `margin` or `font`) into their constituent parts. * * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function expandShorthands() { @@ -196,6 +198,8 @@ public function expandShorthands() * Creates shorthand declarations (e.g. `margin` or `font`) whenever possible. * * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function createShorthands() { @@ -215,6 +219,8 @@ public function createShorthands() * Multiple borders are not yet supported as of 3. * * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function expandBorderShorthand() { @@ -276,6 +282,8 @@ public function expandBorderShorthand() * Handles `margin`, `padding`, `border-color`, `border-style` and `border-width`. * * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function expandDimensionsShorthand() { @@ -336,6 +344,8 @@ public function expandDimensionsShorthand() * into their constituent parts. * * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function expandFontShorthand() { @@ -406,6 +416,8 @@ public function expandFontShorthand() * @see http://www.w3.org/TR/21/colors.html#propdef-background * * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function expandBackgroundShorthand() { @@ -478,6 +490,8 @@ public function expandBackgroundShorthand() /** * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function expandListStyleShorthand() { @@ -561,6 +575,8 @@ public function expandListStyleShorthand() * @param string $sShorthand * * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function createShorthandProperties(array $aProperties, $sShorthand) { @@ -597,6 +613,8 @@ public function createShorthandProperties(array $aProperties, $sShorthand) /** * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function createBackgroundShorthand() { @@ -612,6 +630,8 @@ public function createBackgroundShorthand() /** * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function createListStyleShorthand() { @@ -629,6 +649,8 @@ public function createListStyleShorthand() * Should be run after `create_dimensions_shorthand`! * * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function createBorderShorthand() { @@ -646,6 +668,8 @@ public function createBorderShorthand() * and converts them into shorthand CSS properties. * * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function createDimensionsShorthand() { @@ -720,6 +744,8 @@ public function createDimensionsShorthand() * At least `font-size` AND `font-family` must be present in order to create a shorthand declaration. * * @return void + * + * @deprecated since 8.7.0, will be removed without substitution in version 9.0 in #511 */ public function createFontShorthand() { @@ -810,11 +836,13 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string * * @throws OutputException */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { $sResult = $oOutputFormat->comments($this); if (count($this->aSelectors) === 0) { diff --git a/vendor/sabberworm/php-css-parser/src/RuleSet/RuleSet.php b/vendor/sabberworm/php-css-parser/src/RuleSet/RuleSet.php index adb9be9..8cbbd34 100644 --- a/vendor/sabberworm/php-css-parser/src/RuleSet/RuleSet.php +++ b/vendor/sabberworm/php-css-parser/src/RuleSet/RuleSet.php @@ -102,7 +102,7 @@ public function getLineNo() * * @return void */ - public function addRule(Rule $oRule, Rule $oSibling = null) + public function addRule(Rule $oRule, $oSibling = null) { $sRule = $oRule->getRule(); if (!isset($this->aRules[$sRule])) { diff --git a/vendor/sabberworm/php-css-parser/src/Value/CSSFunction.php b/vendor/sabberworm/php-css-parser/src/Value/CSSFunction.php index 300dc3e..82ffc48 100644 --- a/vendor/sabberworm/php-css-parser/src/Value/CSSFunction.php +++ b/vendor/sabberworm/php-css-parser/src/Value/CSSFunction.php @@ -88,9 +88,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { $aArguments = parent::render($oOutputFormat); return "{$this->sName}({$aArguments})"; diff --git a/vendor/sabberworm/php-css-parser/src/Value/CSSString.php b/vendor/sabberworm/php-css-parser/src/Value/CSSString.php index da498d4..c19b238 100644 --- a/vendor/sabberworm/php-css-parser/src/Value/CSSString.php +++ b/vendor/sabberworm/php-css-parser/src/Value/CSSString.php @@ -99,9 +99,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { $sString = addslashes($this->sString); $sString = str_replace("\n", '\A', $sString); diff --git a/vendor/sabberworm/php-css-parser/src/Value/CalcFunction.php b/vendor/sabberworm/php-css-parser/src/Value/CalcFunction.php index 5ffd071..a3db271 100644 --- a/vendor/sabberworm/php-css-parser/src/Value/CalcFunction.php +++ b/vendor/sabberworm/php-css-parser/src/Value/CalcFunction.php @@ -10,11 +10,15 @@ class CalcFunction extends CSSFunction { /** * @var int + * + * @internal */ const T_OPERAND = 1; /** * @var int + * + * @internal */ const T_OPERATOR = 2; @@ -87,7 +91,7 @@ public static function parse(ParserState $oParserState, $bIgnoreCase = false) sprintf( 'Next token was expected to be an operand of type %s. Instead "%s" was found.', implode(', ', $aOperators), - $oVal + $oParserState->peek() ), '', 'custom', diff --git a/vendor/sabberworm/php-css-parser/src/Value/CalcRuleValueList.php b/vendor/sabberworm/php-css-parser/src/Value/CalcRuleValueList.php index 7dbd26a..17fbe7c 100644 --- a/vendor/sabberworm/php-css-parser/src/Value/CalcRuleValueList.php +++ b/vendor/sabberworm/php-css-parser/src/Value/CalcRuleValueList.php @@ -15,9 +15,11 @@ public function __construct($iLineNo = 0) } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { return $oOutputFormat->implode(' ', $this->aComponents); } diff --git a/vendor/sabberworm/php-css-parser/src/Value/Color.php b/vendor/sabberworm/php-css-parser/src/Value/Color.php index 1cf00cc..a002760 100644 --- a/vendor/sabberworm/php-css-parser/src/Value/Color.php +++ b/vendor/sabberworm/php-css-parser/src/Value/Color.php @@ -56,12 +56,19 @@ public static function parse(ParserState $oParserState, $bIgnoreCase = false) $oParserState->currentLine() ), ]; - } else { + } elseif ($oParserState->strlen($sValue) === 6) { $aColor = [ 'r' => new Size(intval($sValue[0] . $sValue[1], 16), null, true, $oParserState->currentLine()), 'g' => new Size(intval($sValue[2] . $sValue[3], 16), null, true, $oParserState->currentLine()), 'b' => new Size(intval($sValue[4] . $sValue[5], 16), null, true, $oParserState->currentLine()), ]; + } else { + throw new UnexpectedTokenException( + 'Invalid hex color value', + $sValue, + 'custom', + $oParserState->currentLine() + ); } } else { $sColorMode = $oParserState->parseIdentifier(true); @@ -153,9 +160,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { // Shorthand RGB color values if ($oOutputFormat->getRGBHashNotation() && implode('', array_keys($this->aComponents)) === 'rgb') { diff --git a/vendor/sabberworm/php-css-parser/src/Value/LineName.php b/vendor/sabberworm/php-css-parser/src/Value/LineName.php index e231ce3..588cb4c 100644 --- a/vendor/sabberworm/php-css-parser/src/Value/LineName.php +++ b/vendor/sabberworm/php-css-parser/src/Value/LineName.php @@ -56,9 +56,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { return '[' . parent::render(OutputFormat::createCompact()) . ']'; } diff --git a/vendor/sabberworm/php-css-parser/src/Value/Size.php b/vendor/sabberworm/php-css-parser/src/Value/Size.php index 36a3238..af8b3a3 100644 --- a/vendor/sabberworm/php-css-parser/src/Value/Size.php +++ b/vendor/sabberworm/php-css-parser/src/Value/Size.php @@ -16,16 +16,27 @@ class Size extends PrimitiveValue * vh/vw/vm(ax)/vmin/rem are absolute insofar as they don’t scale to the immediate parent (only the viewport) * * @var array + * + * @internal */ - const ABSOLUTE_SIZE_UNITS = ['px', 'cm', 'mm', 'mozmm', 'in', 'pt', 'pc', 'vh', 'vw', 'vmin', 'vmax', 'rem']; + const ABSOLUTE_SIZE_UNITS = [ + 'px', 'pt', 'pc', + 'cm', 'mm', 'mozmm', 'in', + 'vh', 'dvh', 'svh', 'lvh', + 'vw', 'vmin', 'vmax', 'rem', + ]; /** * @var array + * + * @internal */ const RELATIVE_SIZE_UNITS = ['%', 'em', 'ex', 'ch', 'fr']; /** * @var array + * + * @internal */ const NON_SIZE_UNITS = ['deg', 'grad', 'rad', 's', 'ms', 'turn', 'Hz', 'kHz']; @@ -205,14 +216,16 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { $l = localeconv(); $sPoint = preg_quote($l['decimal_point'], '/'); $sSize = preg_match("/[\d\.]+e[+-]?\d+/i", (string)$this->fSize) - ? preg_replace("/$sPoint?0+$/", "", sprintf("%f", $this->fSize)) : $this->fSize; + ? preg_replace("/$sPoint?0+$/", "", sprintf("%f", $this->fSize)) : (string)$this->fSize; return preg_replace(["/$sPoint/", "/^(-?)0\./"], ['.', '$1.'], $sSize) . ($this->sUnit === null ? '' : $this->sUnit); } diff --git a/vendor/sabberworm/php-css-parser/src/Value/URL.php b/vendor/sabberworm/php-css-parser/src/Value/URL.php index cdb911c..92da972 100644 --- a/vendor/sabberworm/php-css-parser/src/Value/URL.php +++ b/vendor/sabberworm/php-css-parser/src/Value/URL.php @@ -86,9 +86,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { return "url({$this->oURL->render($oOutputFormat)})"; } diff --git a/vendor/sabberworm/php-css-parser/src/Value/Value.php b/vendor/sabberworm/php-css-parser/src/Value/Value.php index ce6d579..4b174db 100644 --- a/vendor/sabberworm/php-css-parser/src/Value/Value.php +++ b/vendor/sabberworm/php-css-parser/src/Value/Value.php @@ -67,23 +67,30 @@ public static function parseValue(ParserState $oParserState, array $aListDelimit } // Convert the list to list objects foreach ($aListDelimiters as $sDelimiter) { - if (count($aStack) === 1) { + $iStackLength = count($aStack); + if ($iStackLength === 1) { return $aStack[0]; } - $iStartPosition = null; - while (($iStartPosition = array_search($sDelimiter, $aStack, true)) !== false) { + $aNewStack = []; + for ($iStartPosition = 0; $iStartPosition < $iStackLength; ++$iStartPosition) { + if ($iStartPosition === ($iStackLength - 1) || $sDelimiter !== $aStack[$iStartPosition + 1]) { + $aNewStack[] = $aStack[$iStartPosition]; + continue; + } $iLength = 2; //Number of elements to be joined - for ($i = $iStartPosition + 2; $i < count($aStack); $i += 2, ++$iLength) { + for ($i = $iStartPosition + 3; $i < $iStackLength; $i += 2, ++$iLength) { if ($sDelimiter !== $aStack[$i]) { break; } } $oList = new RuleValueList($sDelimiter, $oParserState->currentLine()); - for ($i = $iStartPosition - 1; $i - $iStartPosition + 1 < $iLength * 2; $i += 2) { + for ($i = $iStartPosition; $i - $iStartPosition < $iLength * 2; $i += 2) { $oList->addListComponent($aStack[$i]); } - array_splice($aStack, $iStartPosition - 1, $iLength * 2 - 1, [$oList]); + $aNewStack[] = $oList; + $iStartPosition += $iLength * 2 - 2; } + $aStack = $aNewStack; } if (!isset($aStack[0])) { throw new UnexpectedTokenException( @@ -156,7 +163,16 @@ public static function parsePrimitiveValue(ParserState $oParserState) } elseif ($oParserState->comes("U+")) { $oValue = self::parseUnicodeRangeValue($oParserState); } else { - $oValue = self::parseIdentifierOrFunction($oParserState); + $sNextChar = $oParserState->peek(1); + try { + $oValue = self::parseIdentifierOrFunction($oParserState); + } catch (UnexpectedTokenException $e) { + if (\in_array($sNextChar, ['+', '-', '*', '/'], true)) { + $oValue = $oParserState->consume(1); + } else { + throw $e; + } + } } $oParserState->consumeWhiteSpace(); return $oValue; diff --git a/vendor/sabberworm/php-css-parser/src/Value/ValueList.php b/vendor/sabberworm/php-css-parser/src/Value/ValueList.php index a93acc7..80b26f9 100644 --- a/vendor/sabberworm/php-css-parser/src/Value/ValueList.php +++ b/vendor/sabberworm/php-css-parser/src/Value/ValueList.php @@ -93,9 +93,11 @@ public function __toString() } /** + * @param OutputFormat|null $oOutputFormat + * * @return string */ - public function render(OutputFormat $oOutputFormat) + public function render($oOutputFormat) { return $oOutputFormat->implode( $oOutputFormat->spaceBeforeListArgumentSeparator($this->sSeparator) . $this->sSeparator