From fbe81d8a7b9f1aaffb651d75f5f05b53d2cdff4d Mon Sep 17 00:00:00 2001 From: Jacson Passold Date: Wed, 15 Nov 2017 19:07:44 -0200 Subject: [PATCH] namespace object is not saved right in metadata too --- src/classes/entities/class-tainacan-metadata.php | 8 ++++---- tests/test-taxonomies.php | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/classes/entities/class-tainacan-metadata.php b/src/classes/entities/class-tainacan-metadata.php index 5e3a25f8d..f8c88d52c 100644 --- a/src/classes/entities/class-tainacan-metadata.php +++ b/src/classes/entities/class-tainacan-metadata.php @@ -79,11 +79,11 @@ class Metadata extends \Tainacan\Entity { } function get_field_type_object(){ - return unserialize( $this->get_mapped_property('field_type_object') ); + return unserialize(base64_decode( $this->get_mapped_property('field_type_object') ) ); } function get_field_type(){ - return $this->get_mapped_property('field_type'); + return base64_decode($this->get_mapped_property('field_type')); } // Setters @@ -133,7 +133,7 @@ class Metadata extends \Tainacan\Entity { function set_field_type_object(\Tainacan\Field_Types\Field_Type $value){ $this->set_field_type( get_class( $value ) ); - return $this->set_mapped_property('field_type_object', serialize($value) ) ; + return $this->set_mapped_property('field_type_object', base64_encode( serialize($value) ) ); // Encode to avoid backslaches removal } /** @@ -143,7 +143,7 @@ class Metadata extends \Tainacan\Entity { * */ private function set_field_type($value){ - return $this->set_mapped_property('field_type', $value ) ; + return $this->set_mapped_property('field_type', base64_encode($value) ) ; // Encode to avoid backslaches removal } // helpers diff --git a/tests/test-taxonomies.php b/tests/test-taxonomies.php index 0fedf7015..617c33ee5 100644 --- a/tests/test-taxonomies.php +++ b/tests/test-taxonomies.php @@ -1,4 +1,7 @@