Skip to content

Commit

Permalink
Fix Invalid argument supplied for foreach() (#5)
Browse files Browse the repository at this point in the history
* Fix warning: Invalid argument supplied for foreach() #985 (#4)

* Bump version to 1.6.20

* Add constant for version in the class

Co-authored-by: Olawale Adesina <[email protected]>
  • Loading branch information
andergmartins and olatechpro authored Apr 13, 2022
1 parent 35458ad commit e2931cf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions EDD_SL_Plugin_Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
* Allows plugins to use their own update API.
*
* @author Easy Digital Downloads
* @version 1.6.19
* @version 1.6.20
*/
class EDD_SL_Plugin_Updater {

const VERSION = '1.6.20';

private $api_url = '';
private $api_data = array();
Expand Down Expand Up @@ -359,8 +361,11 @@ public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
*/
private function convert_object_to_array( $data ) {
$new_data = array();
foreach ( $data as $key => $value ) {
$new_data[ $key ] = is_object( $value ) ? $this->convert_object_to_array( $value ) : $value;

if (is_object($data) || is_array($data)) {
foreach ($data as $key => $value) {
$new_data[ $key ] = is_object($value) ? $this->convert_object_to_array($value) : $value;
}
}

return $new_data;
Expand Down Expand Up @@ -588,4 +593,4 @@ private function verify_ssl() {
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
}

}
}

0 comments on commit e2931cf

Please sign in to comment.