phemellc / yii2-settings

Yii2 Settings Module
Other
151 stars 74 forks source link

problem save #91

Open dimaxz opened 2 years ago

dimaxz commented 2 years ago

error display: strcmp() expects parameter 2 to be string, object given file in /app/vendor/yiisoft/yii2/helpers/BaseHtml.php line 1913 POST value = "1"

//vendor/pheme/yii2-settings/models/BaseSetting.php

        if ($type !== null) {
            $model->type = $type;
        } else {
            $t = gettype($value);
            if ($t == 'string') {//t = "string" - this is correct
                $error = false;
                try {
                    Json::decode($value);//value "1" decode in 1
                } catch (InvalidParamException $e) {
                    $error = true;
                }
                if (!$error) {//if success decode and $t = "object" - wtf!!!???
                    $t = 'object';
                }
            }
            $model->type = $t;
        }