Skip to content

Commit e92b4f3

Browse files
committed
Fix StdClass bug
1 parent c1ff00d commit e92b4f3

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

Ubiquity/controllers/admin/UbiquityMyAdminViewer.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,17 @@ private function labeledInput($input,$value){
631631
return $input;
632632
}
633633

634+
private function _cleanStdClassValue($value){
635+
if($value instanceof \stdClass){
636+
$value=(array) $value;
637+
}
638+
if(is_array($value)){
639+
$value=UArray::asPhpArray($value,"array");
640+
}
641+
$value=str_replace('"', "'", $value);
642+
return $value;
643+
}
644+
634645
public function getConfigDataForm($config) {
635646
$de = $this->jquery->semantic ()->dataElement ( "frmDeConfig", $config );
636647
$keys=array_keys($config);
@@ -661,8 +672,7 @@ public function getConfigDataForm($config) {
661672
$drivers=Database::getAvailableDrivers();
662673
$dbDe = new DataElement ( "de-database", $v );
663674
$dbDe->setDefaultValueFunction(function($name,$value){
664-
if(is_array($value))
665-
$value=UArray::asPhpArray($value,"array");
675+
$value=$this->_cleanStdClassValue($value);
666676
$input= new HtmlFormInput("database-".$name,null,"text",$value);
667677
return $this->labeledInput($input, $value);
668678
});
@@ -693,10 +703,9 @@ public function getConfigDataForm($config) {
693703
$de->setValueFunction("cache", function ($v, $instance, $index) {
694704
$dbDe = new DataElement ( "de-cache", $v );
695705
$dbDe->setDefaultValueFunction(function($name,$value){
696-
if(is_array($value))
697-
$value=UArray::asPhpArray($value,"array");
698-
$input= new HtmlFormInput("cache-".$name,null,"text",$value);
699-
return $this->labeledInput($input, $value);
706+
$value=$this->_cleanStdClassValue($value);
707+
$input= new HtmlFormInput("cache-".$name,null,"text",$value);
708+
return $this->labeledInput($input, $value);
700709
});
701710
$dbDe->setFields ( [ "directory","system","params" ] );
702711
$dbDe->setCaptions ( [ "directory","system","params" ] );

0 commit comments

Comments
 (0)