Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/lazy-loading-responsive-images/lazy-load-responsive-images.php
+++ b/lazy-loading-responsive-images/lazy-load-responsive-images.php
@@ -9,7 +9,7 @@
* Plugin Name: Lazy Loader
* Plugin URI: https://florianbrinkmann.com/en/3350/responsive-images-and-lazy-loading-in-wordpress/
* Description: Lazy loading plugin that supports images, iFrames, video and audio elements and uses lazysizes.js. With manual modification of the markup it is also possible to lazy load background images, scripts, and styles.
- * Version: 8.2.0
+ * Version: 8.2.1
* Author: Florian Brinkmann
* Author URI: https://florianbrinkmann.com/en/
* License: GPL v2 http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
--- a/lazy-loading-responsive-images/src/Plugin.php
+++ b/lazy-loading-responsive-images/src/Plugin.php
@@ -171,10 +171,10 @@
'disable_html_ns' => true,
) );
- // Preserve html entities and conditional IE comments.
+ // Preserve html entities, hex+decimal codes, and conditional IE comments.
// @link https://github.com/ivopetkov/html5-dom-document-php.
$content = preg_replace( '/&([a-zA-Z]*);/', 'lazy-loading-responsive-images-entity1-$1-end', $content );
- $content = preg_replace( '/&#([0-9]*);/', 'lazy-loading-responsive-images-entity2-$1-end', $content );
+ $content = preg_replace( '/&#([0-9a-zA-Z]*);/', 'lazy-loading-responsive-images-entity2-$1-end', $content );
$content = preg_replace( '/<!--[([w ]*)]>/', '<!--[$1]>-->', $content );
$content = str_replace( '<![endif]-->', '<!--<![endif]-->', $content );
--- a/lazy-loading-responsive-images/vendor/autoload.php
+++ b/lazy-loading-responsive-images/vendor/autoload.php
@@ -14,10 +14,7 @@
echo $err;
}
}
- trigger_error(
- $err,
- E_USER_ERROR
- );
+ throw new RuntimeException($err);
}
require_once __DIR__ . '/composer/autoload_real.php';
--- a/lazy-loading-responsive-images/vendor/composer/InstalledVersions.php
+++ b/lazy-loading-responsive-images/vendor/composer/InstalledVersions.php
@@ -27,12 +27,23 @@
class InstalledVersions
{
/**
+ * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
+ * @internal
+ */
+ private static $selfDir = null;
+
+ /**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed;
/**
+ * @var bool
+ */
+ private static $installedIsLocalDir;
+
+ /**
* @var bool|null
*/
private static $canGetVendors;
@@ -309,6 +320,24 @@
{
self::$installed = $data;
self::$installedByVendor = array();
+
+ // when using reload, we disable the duplicate protection to ensure that self::$installed data is
+ // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
+ // so we have to assume it does not, and that may result in duplicate data being returned when listing
+ // all installed packages for example
+ self::$installedIsLocalDir = false;
+ }
+
+ /**
+ * @return string
+ */
+ private static function getSelfDir()
+ {
+ if (self::$selfDir === null) {
+ self::$selfDir = strtr(__DIR__, '\', '/');
+ }
+
+ return self::$selfDir;
}
/**
@@ -322,19 +351,27 @@
}
$installed = array();
+ $copiedLocalDir = false;
if (self::$canGetVendors) {
+ $selfDir = self::getSelfDir();
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
+ $vendorDir = strtr($vendorDir, '\', '/');
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
- $installed[] = self::$installedByVendor[$vendorDir] = $required;
- if (null === self::$installed && strtr($vendorDir.'/composer', '\', '/') === strtr(__DIR__, '\', '/')) {
- self::$installed = $installed[count($installed) - 1];
+ self::$installedByVendor[$vendorDir] = $required;
+ $installed[] = $required;
+ if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
+ self::$installed = $required;
+ self::$installedIsLocalDir = true;
}
}
+ if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
+ $copiedLocalDir = true;
+ }
}
}
@@ -350,7 +387,7 @@
}
}
- if (self::$installed !== array()) {
+ if (self::$installed !== array() && !$copiedLocalDir) {
$installed[] = self::$installed;
}
--- a/lazy-loading-responsive-images/vendor/composer/autoload_static.php
+++ b/lazy-loading-responsive-images/vendor/composer/autoload_static.php
@@ -7,22 +7,22 @@
class ComposerStaticInita21d1f93de4e18f6084492a2be69518d
{
public static $prefixLengthsPsr4 = array (
- 'M' =>
+ 'M' =>
array (
'Masterminds\' => 12,
),
- 'F' =>
+ 'F' =>
array (
'FlorianBrinkmann\LazyLoadResponsiveImages\' => 42,
),
);
public static $prefixDirsPsr4 = array (
- 'Masterminds\' =>
+ 'Masterminds\' =>
array (
0 => __DIR__ . '/..' . '/masterminds/html5/src',
),
- 'FlorianBrinkmann\LazyLoadResponsiveImages\' =>
+ 'FlorianBrinkmann\LazyLoadResponsiveImages\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
--- a/lazy-loading-responsive-images/vendor/composer/installed.php
+++ b/lazy-loading-responsive-images/vendor/composer/installed.php
@@ -1,9 +1,9 @@
<?php return array(
'root' => array(
'name' => 'florianbrinkmann/lazy-loading-responsive-images',
- 'pretty_version' => '8.2.0',
- 'version' => '8.2.0.0',
- 'reference' => 'a48ef29925d97c95258d264e05491a76848f01b3',
+ 'pretty_version' => '8.2.1',
+ 'version' => '8.2.1.0',
+ 'reference' => 'a001fac0a265a004a612c52b281cf23b9be42752',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -11,9 +11,9 @@
),
'versions' => array(
'florianbrinkmann/lazy-loading-responsive-images' => array(
- 'pretty_version' => '8.2.0',
- 'version' => '8.2.0.0',
- 'reference' => 'a48ef29925d97c95258d264e05491a76848f01b3',
+ 'pretty_version' => '8.2.1',
+ 'version' => '8.2.1.0',
+ 'reference' => 'a001fac0a265a004a612c52b281cf23b9be42752',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
--- a/lazy-loading-responsive-images/vendor/composer/platform_check.php
+++ b/lazy-loading-responsive-images/vendor/composer/platform_check.php
@@ -19,8 +19,7 @@
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
- trigger_error(
- 'Composer detected issues in your platform: ' . implode(' ', $issues),
- E_USER_ERROR
+ throw new RuntimeException(
+ 'Composer detected issues in your platform: ' . implode(' ', $issues)
);
}