Bug: Invalid argument supplied for foreach()
-
Warning: Invalid argument supplied for foreach() in ./plugins/responsive-lightbox/responsive-lightbox.php on line 568Problematic function:
/**
* Update plugin hook.
*
* @return void
*/
public function update_plugin( $upgrader_object, $options ) {
// plugin update?
if ( $options[‘action’] === ‘update’ && $options[‘type’] === ‘plugin’ ) {
// get current plugin name
$current_plugin = plugin_basename( __FILE__ );// search for a plugin
foreach ( $options[‘plugins’] as $plugin ) {
// found?
if ( $plugin === $current_plugin ) {
// 2.3.1
if ( version_compare( $this->version, ‘2.3.1’, ‘<‘ ) ) {
// grant new capabilities just before the version update
$this->grant_capabilities();
}
}
}
}
}If you check how
upgrader_process_completeis called, then you will notice, that there is no key plugins defined./** This action is documented in wp-admin/includes/class-wp-upgrader.php */
do_action(
‘upgrader_process_complete’,
$this,
array(
‘action’ => ‘update’,
‘type’ => ‘core’,
)
);Please update your code, that it valides variable exitence before trying to use it.
The topic ‘Bug: Invalid argument supplied for foreach()’ is closed to new replies.