zjh 4 mesiacov pred
rodič
commit
9fb5b35bbd

+ 8 - 1
src/Driver/Entity/Base.php

@@ -804,6 +804,12 @@ class Base {
         foreach ($values as $key => $value) {
             $property = $this->entity()->convertToProperty($key);
             if($this->hasProperty($key)) {
+                if(is_array($value)) {
+                    $value = json_encode($value, JSON_UNESCAPED_UNICODE);
+                }
+                if(is_object($value)) {
+                    $value = serialize($value);
+                }
                 $this->$property = $value;
             }
         }
@@ -1838,7 +1844,7 @@ class Base {
         $data['pages']['total'] = (int) ($count ? $count : 0);
         $data['pages']['currentPage'] = $page;
         $data['pages']['totalPage'] = ceil($data['pages']['total'] / $pageSize);
-        $data['lists'] = array();
+        $data['lists'] = isset($data['lists']) ? $data['lists'] : array();
         if ($data['pages']['currentPage'] > $data['pages']['totalPage']) {
             return false;
         }
@@ -1861,6 +1867,7 @@ class Base {
         $data['pages']['pagination'] = $pagination;
         $data['pages']['limitStart'] = (min($page, $data['pages']['totalPage']) - 1) * $pageSize;
         $data['pages']['pageSize'] = (int) $pageSize;
+
         return true;
     }
     /**

+ 4 - 1
src/View/smarty/sysplugins/smarty_internal_templatecompilerbase.php

@@ -1151,6 +1151,9 @@ abstract class Smarty_Internal_TemplateCompilerBase
      */
     public function trigger_template_error($args = null, $line = null, $tagline = null)
     {
+        if(!is_numeric($line)) {
+            $line = 400;
+        }
         $lex = $this->parser->lex;
         if ($tagline === true) {
             // get line number of Tag
@@ -1159,7 +1162,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
             // get template source line which has error
             $line = $lex->line;
         } else {
-            $line = (int) $line;
+            $line = intval($line);
         }
 
         if (in_array($this->template->source->type, array('eval', 'string'))) {

+ 9 - 1
src/View/smarty/sysplugins/smartycompilerexception.php

@@ -17,7 +17,7 @@ class SmartyCompilerException extends SmartyException
      *
      * @type int|null
      */
-    public $line = null;
+    public $line = 0;
 
     /**
      * The template source snippet relating to the error
@@ -39,4 +39,12 @@ class SmartyCompilerException extends SmartyException
      * @type string|null
      */
     public $template = null;
+    public function __construct($message, $code = 400, Exception $previous = null){
+        if(!is_numeric($code)){
+            $code = 400;
+        }else{
+            $code = intval($code);
+        }
+        parent::__construct($message, $code, $previous);
+    }
 }

+ 3 - 0
src/View/smarty/sysplugins/smartyexception.php

@@ -9,6 +9,9 @@ class SmartyException extends Exception
 {
     public static $escape = false;
 
+    public function __construct($message, $code = 400, Exception $previous = null){
+        parent::__construct($message, 400, $previous);
+    }
     public function __toString()
     {
         return ' --> Smarty: ' . (self::$escape ? htmlentities($this->message) : $this->message) . ' <-- ';