PHP 8.2 Deprecation warnings
-
The plugin is rising a PHP warning with PHP 8.2: “Deprecated: Creation of dynamic property DateInterval::$w is deprecated in /var/www/html/wp-content/plugins/resmushit-image-optimizer/resmushit.inc.php on line 118”
Plugin version: 0.4.13
My fix:
diff –git a/wp-content/plugins/resmushit-image-optimizer/resmushit.inc.php b/wp-content/plugins/resmushit-image-optimizer/resmushit.inc.php
index b87bad74..3ce2a2e6 100644
— a/wp-content/plugins/resmushit-image-optimizer/resmushit.inc.php
+++ b/wp-content/plugins/resmushit-image-optimizer/resmushit.inc.php
@@ -115,7 +115,7 @@ function time_elapsed_string($duration, $full = false) {
$ago = new DateTime($datetime);
$diff = $now->diff($ago);– $diff->w = floor($diff->d / 7);
+ @$diff->w = floor($diff->d / 7);
$diff->d -= $diff->w * 7;
$string = array(
- The topic ‘PHP 8.2 Deprecation warnings’ is closed to new replies.