From b9a515c1013b9ba8f0704ffd8cf47cd7a4fe8a96 Mon Sep 17 00:00:00 2001 From: YJSoft Date: Sat, 26 Apr 2014 18:16:08 +0900 Subject: [PATCH 1/5] =?UTF-8?q?#588=20=ED=85=9C=ED=94=8C=EB=A6=BF=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=98=A4=EB=A5=98=EC=8B=9C=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=A0=95=EB=B3=B4=EC=99=80=20=ED=95=B4=EB=8B=B9=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=EA=B0=80=20=EB=B0=9C=EC=83=9D=ED=95=9C=20?= =?UTF-8?q?=ED=85=9C=ED=94=8C=EB=A6=BF=20=ED=8C=8C=EC=9D=BC=EC=9D=84=20?= =?UTF-8?q?=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit eval에서 발생하는 오류 대신 실제 오류가 발생한 템플릿 파일을 출력함으로 디버깅시 참고 가능하게함 개선 코드(by @lansi951 ) 반영 --- classes/template/TemplateHandler.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index 3a9d72b66..d71b3abe8 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -370,7 +370,12 @@ class TemplateHandler else { $eval_str = "?>" . $buff; - eval($eval_str); + @eval($eval_str); + $error_info = error_get_last(); + if ($error_info['type'] == 4) + { + echo "

Error Pharsing Template - {$error_info['message']} in template file {$this->file}

"; + } } return ob_get_clean(); From 96de92beedf91a28a162e261439aebcfb05ff14b Mon Sep 17 00:00:00 2001 From: YJSoft Date: Sun, 27 Apr 2014 01:02:02 +0900 Subject: [PATCH 2/5] =?UTF-8?q?file=20cache=20=EC=82=AC=EC=9A=A9=EC=8B=9C?= =?UTF-8?q?=20=EC=98=A4=EB=A5=98=20=EC=98=88=EC=99=B8=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=EA=B0=80=20=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8D=98=EC=A0=90=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20&=20=EC=98=A4=ED=83=80=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit include문 사용시 parse error 예외처리가 불가능함으로 FileHandler::readFile로 읽어 들인뒤 eval하는 방식으로 수정하였습니다. 추가:pharse가 아니라 parse네요;;; --- classes/template/TemplateHandler.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index d71b3abe8..c043bf660 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -365,7 +365,14 @@ class TemplateHandler ob_start(); if(substr($buff, 0, 7) == 'file://') { - include(substr($buff, 7)); + $eval_str = FileHandler::readFile(substr($buff, 7)); + $eval_str_buffed = "?>" . $eval_str; + @eval($eval_str_buffed); + $error_info = error_get_last(); + if ($error_info['type'] == 4) + { + echo "

Error Parsing Template - {$error_info['message']} in template file {$this->file}

"; + } } else { @@ -374,7 +381,7 @@ class TemplateHandler $error_info = error_get_last(); if ($error_info['type'] == 4) { - echo "

Error Pharsing Template - {$error_info['message']} in template file {$this->file}

"; + echo "

Error Parsing Template - {$error_info['message']} in template file {$this->file}

"; } } From 5c9bf55b97dff90c94c048f921f3b15d07b23a1e Mon Sep 17 00:00:00 2001 From: YJSoft Date: Sun, 11 May 2014 19:33:29 +0900 Subject: [PATCH 3/5] =?UTF-8?q?exception=EC=9D=84=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/template/TemplateHandler.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index c043bf660..1874bce03 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -11,7 +11,7 @@ */ class TemplateHandler { - +e private $compiled_path = 'files/cache/template_compiled/'; ///< path of compiled caches files private $path = NULL; ///< target directory private $filename = NULL; ///< target filename @@ -371,7 +371,7 @@ class TemplateHandler $error_info = error_get_last(); if ($error_info['type'] == 4) { - echo "

Error Parsing Template - {$error_info['message']} in template file {$this->file}

"; + throw new Exception("Error Parsing Template - {$error_info['message']} in template file {$this->file}"); } } else @@ -381,7 +381,7 @@ class TemplateHandler $error_info = error_get_last(); if ($error_info['type'] == 4) { - echo "

Error Parsing Template - {$error_info['message']} in template file {$this->file}

"; + throw new Exception("Error Parsing Template - {$error_info['message']} in template file {$this->file}"); } } From 9ee99ea7b9cf158968c01179a3b34c1add14f098 Mon Sep 17 00:00:00 2001 From: YJSoft Date: Sun, 11 May 2014 19:57:12 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=EC=98=A4=ED=83=80=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=EB=B0=8F=20=EC=A3=BC=EC=84=9D=EB=AC=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/template/TemplateHandler.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index 1874bce03..90814ab66 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -11,7 +11,7 @@ */ class TemplateHandler { -e + private $compiled_path = 'files/cache/template_compiled/'; ///< path of compiled caches files private $path = NULL; ///< target directory private $filename = NULL; ///< target filename @@ -365,10 +365,12 @@ e ob_start(); if(substr($buff, 0, 7) == 'file://') { + //load cache file from disk $eval_str = FileHandler::readFile(substr($buff, 7)); $eval_str_buffed = "?>" . $eval_str; @eval($eval_str_buffed); $error_info = error_get_last(); + //parse error if ($error_info['type'] == 4) { throw new Exception("Error Parsing Template - {$error_info['message']} in template file {$this->file}"); @@ -379,6 +381,7 @@ e $eval_str = "?>" . $buff; @eval($eval_str); $error_info = error_get_last(); + //parse error if ($error_info['type'] == 4) { throw new Exception("Error Parsing Template - {$error_info['message']} in template file {$this->file}"); From a35c51c311b2490834f11615ac45ad7c50147b83 Mon Sep 17 00:00:00 2001 From: YJSoft Date: Thu, 29 May 2014 11:31:28 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=5F=5FDEBUG=5F=5F=EA=B0=80=201=EC=9D=BC?= =?UTF-8?q?=EB=95=8C=EB=A7=8C=20file=20=EC=BA=90=EC=8B=9C=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=EC=8B=9C=20eval?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit __DEBUG__가 0일경우 기존 include 방식을 사용 --- classes/template/TemplateHandler.class.php | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index 90814ab66..7c0b53d71 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -365,15 +365,22 @@ class TemplateHandler ob_start(); if(substr($buff, 0, 7) == 'file://') { - //load cache file from disk - $eval_str = FileHandler::readFile(substr($buff, 7)); - $eval_str_buffed = "?>" . $eval_str; - @eval($eval_str_buffed); - $error_info = error_get_last(); - //parse error - if ($error_info['type'] == 4) + if(__DEBUG__) { - throw new Exception("Error Parsing Template - {$error_info['message']} in template file {$this->file}"); + //load cache file from disk + $eval_str = FileHandler::readFile(substr($buff, 7)); + $eval_str_buffed = "?>" . $eval_str; + @eval($eval_str_buffed); + $error_info = error_get_last(); + //parse error + if ($error_info['type'] == 4) + { + throw new Exception("Error Parsing Template - {$error_info['message']} in template file {$this->file}"); + } + } + else + { + include(substr($buff, 7)); } } else