diff --git a/cmpUtil.php b/cmpUtil.php index 4c64810..a17cd70 100644 --- a/cmpUtil.php +++ b/cmpUtil.php @@ -8,6 +8,7 @@ var $gitCommit = ""; var $gitComment = ""; + var $maxFileSize = 104856; function toArray($obj) { $re = array(); @@ -145,11 +146,11 @@ function readFile($file) { return @file_get_contents( - $file , // string - false , // bool $use_include_path - null , // ?resource $context - 0 , // int $offset - $this->parm["maxFileSize"] , // ?int $length + $file , // string + false , // bool $use_include_path + null , // ?resource $context + 0 , // int $offset + $this->maxFileSize , // ?int $length ); } @@ -198,9 +199,21 @@ date_default_timezone_set($this->parm["timezone"]); } - if(!@$this->parm["maxFileSize"]) - $this->parm["maxFileSize"] = 1048576; - $this->d("Set maxFileSize '" . $this->parm["maxFileSize"] . "'"); + do { + if(!isset($this->parm["maxFileSize"])) + break; + + if(!$this->parm["maxFileSize"]) + break; + + if(!is_numeric($this->parm["maxFileSize"])) { + $this->d("Not numeric maxFileSize"); + break; + } + + $this->maxFileSize = 1*$this->parm["maxFileSize"]; + $this->d("Set maxFileSize '" . $this->maxFileSize . "'"); + } while(0); if(isset($this->parm["php_ini"]) && is_array($this->parm["php_ini"])) { foreach($this->parm["php_ini"] as $k => $v) {