@@ -17,12 +17,23 @@ class ErrorHandler
1717 */
1818 private const ERRORS = E_ALL & ~E_NOTICE ;
1919
20+ /**
21+ * Parse Error Constant
22+ */
23+ private const PARSE_ERROR = 4 ;
24+
25+ /**
26+ * Error Zero Constant
27+ */
28+ private const ERROR_ZERO = 0 ;
29+
30+
2031 /**
2132 * For plates template engine
2233 *
2334 * @var string
2435 */
25- private $ evaluatedFile = '' ;
36+ private $ evaluatedFile = null ;
2637
2738 public function __construct ()
2839 {
@@ -73,7 +84,8 @@ public function logError($num, $str, $file, $line, $context = null)
7384 $ _error = & load_class ('Exceptions ' , 'core ' );
7485 $ _error ->log_exception ($ num , $ str , $ file , $ line );
7586
76- $ this ->logException (new \ErrorException ($ str , 0 , $ num , $ file , $ line ));
87+ $ this ->logException (new \ErrorException ($ str , $ num , $ num , $ file , $ line ));
88+
7789 }
7890
7991 /**
@@ -93,9 +105,14 @@ public function logException($e)
93105 $ file = ($ this ->evaluatedFile ) ? $ this ->evaluatedFile : $ e ->getFile ();
94106 $ line = $ e ->getLine ();
95107 $ message = $ e ->getMessage ();
108+ $ num = $ e ->getCode ();
109+
110+ if ($ num == self ::ERROR_ZERO ) {
111+ $ num = self ::PARSE_ERROR ;
112+ }
96113
97114 $ _error = & load_class ('Exceptions ' , 'core ' );
98- $ _error ->log_exception (' error ' , 'Exception: ' . $ message , $ file , $ line );
115+ $ _error ->log_exception ($ num , 'Exception: ' . $ message , $ file , $ line );
99116
100117 $ trace = '' ;
101118 $ traceArr = $ e ->getTrace ();
@@ -203,7 +220,7 @@ private function checkEvaluated($file)
203220 {
204221 $ evaluated = false ;
205222
206- if (strpos ($ file , " eval()'d code " ) !== false ) {
223+ if (_evaluated ($ file) ) {
207224 $ evaluated = true ;
208225 }
209226
0 commit comments