Remove double unserialization

This commit is contained in:
Mike Jolley 2017-03-31 12:10:20 +01:00
parent b50312a1d8
commit 14802a0307
4 changed files with 5 additions and 5 deletions

View File

@ -91,7 +91,7 @@ class WC_Admin_Meta_Boxes {
* Show any stored error messages.
*/
public function output_errors() {
$errors = maybe_unserialize( get_option( 'woocommerce_meta_box_errors' ) );
$errors = array_filter( (array) get_option( 'woocommerce_meta_box_errors' ) );
if ( ! empty( $errors ) ) {

View File

@ -1752,7 +1752,7 @@ class WC_API_Products extends WC_API_Resource {
$id = $product->get_id();
$variations = $request['variations'];
$attributes = (array) maybe_unserialize( get_post_meta( $id, '_product_attributes', true ) );
$attributes = (array) get_post_meta( $id, '_product_attributes', true );
foreach ( $variations as $menu_order => $data ) {
$variation_id = isset( $data['id'] ) ? absint( $data['id'] ) : 0;

View File

@ -342,7 +342,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
* @since 3.0.0
*/
protected function read_attributes( &$product ) {
$meta_values = maybe_unserialize( get_post_meta( $product->get_id(), '_product_attributes', true ) );
$meta_values = get_post_meta( $product->get_id(), '_product_attributes', true );
if ( $meta_values ) {
$attributes = array();
@ -375,7 +375,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
* @since 3.0.0
*/
protected function read_downloads( &$product ) {
$meta_values = array_filter( (array) maybe_unserialize( get_post_meta( $product->get_id(), '_downloadable_files', true ) ) );
$meta_values = array_filter( (array) get_post_meta( $product->get_id(), '_downloadable_files', true ) );
if ( $meta_values ) {
$downloads = array();

View File

@ -162,7 +162,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
*/
public function get_variation_default_attributes() {
wc_deprecated_function( 'WC_Product_Variable::get_variation_default_attributes', '3.0', 'WC_Product::get_default_attributes' );
return apply_filters( 'woocommerce_product_default_attributes', array_filter( (array) maybe_unserialize( $this->get_default_attributes() ) ), $this );
return apply_filters( 'woocommerce_product_default_attributes', $this->get_default_attributes(), $this );
}
/**