Bug Report: Missing plugin property in update API response (causing PHP warnings
-
I’m seeing malformed update data being returned by the TranslatePress Developer add-on updater.
The WordPress core WP_Automatic_Updater expects each entry in the update_plugins transient to include a plugin property, but the API response for translatepress-developer/index.php does not contain it.
Evidence from debug log:
[update_plugins_malformed] Object for translatepress-developer/index.php missing ->plugin.
Data: {“name”:”TranslatePress Developer”,”new_version”:”1.6.9″,”stable_version”:”1.6.9″,”sections”:{“description”:””,”changelog”:”…”}}Because of that, WordPress logs:
PHP Warning: Undefined property: stdClass::$plugin in
wp-admin/includes/class-wp-automatic-updater.php on line 228How to reproduce:
1. Activate TranslatePress Developer (v1.6.9 or earlier) alongside TranslatePress core.
2. Run wp_update_plugins() (or wait for WordPress to perform its update check).
3. Inspect the object in get_site_transient(‘update_plugins’)->response[‘translatepress-developer/index.php’].
You’ll see it lacks the required plugin field.Expected behavior:
The update object should include something like:{
“plugin”: “translatepress-developer/index.php”,
“slug”: “translatepress-developer”,
“new_version”: “1.6.9”,
…
}Temporary fix used:
We patched it locally to prevent the warning:add_filter(‘pre_set_site_transient_update_plugins’, function($transient) {
if (!is_object($transient) || empty($transient->response) || !is_array($transient->response)) {
return $transient;
}foreach ($transient->response as $file => $data) { if ($file === 'translatepress-developer/index.php' && is_object($data) && !isset($data->plugin)) { $data->plugin = $file; $transient->response[$file] = $data; } } return $transient;}, 20);
This stops the core PHP warning, but the root cause appears to be that the update response generated by the TranslatePress Developer add-on is missing the plugin key entirely.
Could you please review this in your updater code?
The topic ‘Bug Report: Missing plugin property in update API response (causing PHP warnings’ is closed to new replies.