Only need one numeric check

This commit is contained in:
Mike Jolley 2015-07-10 10:48:29 +01:00
parent 3c2b54b360
commit d5a74203c2
1 changed files with 2 additions and 6 deletions

View File

@ -291,11 +291,7 @@ class WC_API_Products extends WC_API_Resource {
return $this->get_product( $id ); return $this->get_product( $id );
} catch ( WC_API_Exception $e ) { } catch ( WC_API_Exception $e ) {
// Remove the product when fails (and post actually created)
if ( is_int( $id ) ) {
$this->clear_product( $id ); $this->clear_product( $id );
}
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) ); return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
} }
} }
@ -2322,7 +2318,7 @@ class WC_API_Products extends WC_API_Resource {
* Clear product * Clear product
*/ */
protected function clear_product( $product_id ) { protected function clear_product( $product_id ) {
if ( !is_int( $product_id ) || 0 >= $product_id ) { if ( ! is_numeric( $product_id ) || 0 >= $product_id ) {
return; return;
} }