From 49bd15247d8a52ae5bd4a3cc15cf28adb03e3f8e Mon Sep 17 00:00:00 2001 From: Antonio de la Rosa Date: Tue, 15 Mar 2016 01:24:38 +0100 Subject: [PATCH] Change behaviour from serialize to json for language elements --- src/CoreFields/I18nField.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/CoreFields/I18nField.php b/src/CoreFields/I18nField.php index 0b014ba..b817f3f 100644 --- a/src/CoreFields/I18nField.php +++ b/src/CoreFields/I18nField.php @@ -15,6 +15,7 @@ use PhangoApp\PhaI18n\I18n; use PhangoApp\PhaModels\Forms\MultiLangForm; use PhangoApp\PhaModels\Forms\TextForm; use PhangoApp\PhaModels\CoreFields\SlugifyField; +use PhangoApp\PhaModels\CoreFields\TextField; /** * Multilanguage fields. @@ -36,10 +37,10 @@ class I18nField extends PhangoField { //This method is used for check all members from serialize - function __construct($type_field) + function __construct() { - $this->type_field=&$type_field; + $this->type_field=new TextField(); $this->parameters=[]; } @@ -67,7 +68,7 @@ class I18nField extends PhangoField { } - $ser_value=addslashes(serialize($value)); + $ser_value=addslashes(json_encode($value)); return $ser_value; @@ -85,7 +86,7 @@ class I18nField extends PhangoField { static function show_formatted($value) { - $arr_lang=@unserialize($value); + $arr_lang=json_decode($value, true); settype($arr_lang, 'array');