Merge pull request #18119 from woocommerce/fix/18104

Filter passed images before processing.
This commit is contained in:
Claudiu Lodromanean 2017-12-12 10:21:05 -08:00 committed by GitHub
commit 7a726123ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -1046,7 +1046,9 @@ class WC_REST_Products_Controller extends WC_REST_Legacy_Products_Controller {
* @return WC_Product
*/
protected function set_product_images( $product, $images ) {
if ( is_array( $images ) && ! empty( $images ) ) {
$images = is_array( $images ) ? array_filter( $images ) : array();
if ( ! empty( $images ) ) {
$gallery = array();
foreach ( $images as $image ) {