| @@ -348,8 +348,9 @@ | ||
| 348 | 348 | { |
| 349 | 349 | $xPath = new \DOMXPath($xmlDocument); |
| 350 | 350 | $this->clearAllCaches(); |
| 351 | 351 | $this->purgeVisitedNodes(); |
| 352 | + // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler -- Third-party library (Emogrifier), error handler needed for XPath warnings | |
| 352 | 353 | \set_error_handler([$this, 'handleXpathQueryWarnings'], E_WARNING); |
| 353 | 354 | |
| 354 | 355 | $this->normalizeStyleAttributesOfAllNodes($xPath); |
| 355 | 356 | |
| @@ -770,9 +771,9 @@ | ||
| 770 | 771 | self::CACHE_KEY_CSS_DECLARATIONS_BLOCK, |
| 771 | 772 | self::CACHE_KEY_COMBINED_STYLES, |
| 772 | 773 | ]; |
| 773 | 774 | if (!in_array($key, $allowedCacheKeys, true)) { |
| 774 | - throw new \InvalidArgumentException('Invalid cache key: ' . $key, 1391822035); | |
| 775 | + throw new \InvalidArgumentException('Invalid cache key: ' . esc_html($key), 1391822035); | |
| 775 | 776 | } |
| 776 | 777 | |
| 777 | 778 | $this->caches[$key] = []; |
| 778 | 779 | } |
| @@ -1767,9 +1768,9 @@ | ||
| 1767 | 1768 | $type, |
| 1768 | 1769 | $message, |
| 1769 | 1770 | $file, |
| 1770 | 1771 | $line, |
| 1771 | - array $context | |
| 1772 | + array $context = [] | |
| 1772 | 1773 | ) { |
| 1773 | 1774 | $selector = ''; |
| 1774 | 1775 | if (isset($context['cssRule']['selector'])) { |
| 1775 | 1776 | // warnings generated by invalid/unrecognized selectors in method process() |
| @@ -1783,9 +1784,9 @@ | ||
| 1783 | 1784 | } |
| 1784 | 1785 | |
| 1785 | 1786 | if ($selector !== '') { |
| 1786 | 1787 | throw new \InvalidArgumentException( |
| 1787 | - sprintf('%1$s in selector >> %2$s << in %3$s on line %4$u', $message, $selector, $file, $line), | |
| 1788 | + sprintf('%1$s in selector >> %2$s << in %3$s on line %4$u', esc_html($message), esc_html($selector), esc_html($file), (int)$line), | |
| 1788 | 1789 | 1509279985 |
| 1789 | 1790 | ); |
| 1790 | 1791 | } |
| 1791 | 1792 | |
| @@ -1791,9 +1792,9 @@ | ||
| 1791 | 1792 | |
| 1792 | 1793 | // Catches eventual warnings generated by method getAllNodesWithStyleAttribute() |
| 1793 | 1794 | if (isset($context['xPath'])) { |
| 1794 | 1795 | throw new \RuntimeException( |
| 1795 | - sprintf('%1$s in %2$s on line %3$u', $message, $file, $line), | |
| 1796 | + sprintf('%1$s in %2$s on line %3$u', esc_html($message), esc_html($file), (int)$line), | |
| 1796 | 1797 | 1509280067 |
| 1797 | 1798 | ); |
| 1798 | 1799 | } |
| 1799 | 1800 | |
| @@ -1811,5 +1812,5 @@ | ||
| 1811 | 1812 | public function setDebug($debug) |
| 1812 | 1813 | { |
| 1813 | 1814 | $this->debug = $debug; |
| 1814 | 1815 | } |
| 1815 | -} | |
| 1816 | +} | |