Merge pull request #12998 from todeveni/patch-3

Cast position as integer
This commit is contained in:
Claudio Sanches 2017-01-27 13:20:52 -02:00 committed by GitHub
commit 8c84836423
1 changed files with 1 additions and 1 deletions

View File

@ -855,7 +855,7 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller {
throw new WC_REST_Exception( 'woocommerce_product_invalid_image_id', sprintf( __( '#%s is an invalid image ID.', 'woocommerce' ), $attachment_id ), 400 );
}
if ( isset( $image['position'] ) && 0 === $image['position'] ) {
if ( isset( $image['position'] ) && 0 === absint( $image['position'] ) ) {
$product->set_image_id( $attachment_id );
} else {
$gallery[] = $attachment_id;