diff --git a/src/sammo/Session.php b/src/sammo/Session.php index a9c73f5c..82084712 100644 --- a/src/sammo/Session.php +++ b/src/sammo/Session.php @@ -44,7 +44,7 @@ class Session { ini_set('session.use_only_cookies', false); ini_set('session.use_cookies', false); ini_set('session.use_trans_sid', false); - ini_set('session.cache_limiter', null); + ini_set('session.cache_limiter', "none"); session_start($this->sessionID); // second session_start $this->writeClosed = false; return $this; @@ -113,7 +113,7 @@ class Session { } public function __set(string $name, $value){ - if(key_exists($key, $this->PROTECED_NAMES)){ + if(key_exists($name, $this->PROTECED_NAMES)){ trigger_error("{$name}은 외부에서 쓰기 금지된 Session 변수입니다.", E_USER_NOTICE); return; } diff --git a/src/sammo/StringUtil.php b/src/sammo/StringUtil.php index 011a1d26..2c4e74de 100644 --- a/src/sammo/StringUtil.php +++ b/src/sammo/StringUtil.php @@ -163,6 +163,7 @@ class StringUtil { $size = strlen($str); $count = ($maxsize - $size) / 2; + $string = ''; for($i=0; $i < $count; $i++) { $string = $string.$ch; diff --git a/src/sammo/Util.php b/src/sammo/Util.php index 99c50867..88d46ecc 100644 --- a/src/sammo/Util.php +++ b/src/sammo/Util.php @@ -65,7 +65,7 @@ class Util extends \utilphp\util{ } return intval($val); } - throw new InvalidArgumentException('올바르지 않은 타입형 :'.$val); + throw new \InvalidArgumentException('올바르지 않은 타입형 :'.$val); } /** @@ -125,7 +125,7 @@ class Util extends \utilphp\util{ } $idx = 0; $jmp = 0; - foreach ($arr as $key=>&$value) { + foreach ($array as $key=>&$value) { if(is_string($key)){ return true; } @@ -156,7 +156,7 @@ class Util extends \utilphp\util{ return $dict; } - foreach ($arr as $key=>$value) { + foreach ($dict as $key=>$value) { if($value === null){ unset($dict[$key]); } @@ -209,9 +209,9 @@ class Util extends \utilphp\util{ /** * 각 값의 비중에 따라 랜덤한 값을 선택 * - * @param array 각 수치의 비중 + * @param array $items 각 수치의 비중 * - * @return object 선택된 랜덤 값의 key값. 단순 배열인 경우에는 index + * @return int|string 선택된 랜덤 값의 key값. 단순 배열인 경우에는 index */ public static function choiceRandomUsingWeight(array $items){ $sum = 0; @@ -235,7 +235,7 @@ class Util extends \utilphp\util{ /** * 배열의 아무거나 고름. Python의 random.choice() * - * @param array 선택하고자 하는 배열 + * @param array $items 선택하고자 하는 배열 * * @return object 선택된 value값. */ diff --git a/src/sammo/WebUtil.php b/src/sammo/WebUtil.php index bb5f2556..236354ce 100644 --- a/src/sammo/WebUtil.php +++ b/src/sammo/WebUtil.php @@ -2,6 +2,11 @@ namespace sammo; class WebUtil{ + + private function __construct(){ + + } + public static function escapeIPv4($ip){ return str_replace('.', '\\.', $ip); } @@ -19,13 +24,13 @@ class WebUtil{ // http://thisinterestsme.com/receiving-json-post-data-via-php/ // http://thisinterestsme.com/php-json-error-handling/ if(strcasecmp($_SERVER['REQUEST_METHOD'], 'POST') != 0){ - throw new Exception('Request method must be POST!'); + throw new \Exception('Request method must be POST!'); } //Make sure that the content type of the POST request has been set to application/json $contentType = isset($_SERVER["CONTENT_TYPE"]) ? trim($_SERVER["CONTENT_TYPE"]) : ''; if(strcasecmp($contentType, 'application/json') != 0){ - throw new Exception('Content type must be: application/json'); + throw new \Exception('Content type must be: application/json'); } //Receive the RAW post data. @@ -39,7 +44,7 @@ class WebUtil{ //In some cases, this will happen. if(is_null($decoded) && $jsonError == JSON_ERROR_NONE){ - throw new Exception('Could not decode JSON!'); + throw new \Exception('Could not decode JSON!'); } //If an error exists. @@ -67,7 +72,7 @@ class WebUtil{ $error .= 'Unknown error!'; break; } - throw new Exception($error); + throw new \Exception($error); } return $decoded;