[wp-trac] [WordPress Trac] #44582: Notice: Undefined property:stdClass::$plugin - wordpress
WordPress Trac
noreply at wordpress.org
Wed Dec 1 10:06:23 UTC 2021
#44582: Notice: Undefined property:stdClass::$plugin - wordpress
-------------------------------+------------------------------
Reporter: sangwan4pankaj | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: 4.9.7
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by moxymore):
As a temporal fix, I have added this filter in functions.php file. It
basically checks the transients->response property, and foreach response,
if the plugin property is missing, it adds it by picking the key, which is
exactely what we need, since it is formed like this : plugin's directory
name . '/' . plugin's init file . '.php'.
{{{#!php
<?php
add_filter('site_transient_update_plugins', function($transients) {
if (!empty($transients->response)) {
foreach ($transients->response as $key => $plugin) {
if (!property_exists($plugin, "plugin") &&
isset($plugin->slug)) {
$transients->response[$key]->plugin = $key;
}
}
}
return $transients;
});
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44582#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list