@@ -41,7 +41,7 @@ class YiiBase
4141 private static $ _logger ;
4242 public static function getVersion ()
4343 {
44- return '1.1.31-dev ' ;
44+ return '1.1.31 ' ;
4545 }
4646 public static function createWebApplication ($ config =null )
4747 {
@@ -1607,7 +1607,7 @@ public function displayError($code,$message,$file,$line)
16071607 if (YII_DEBUG )
16081608 {
16091609 echo "<h1>PHP Error [ $ code]</h1> \n" ;
1610- echo "<p> $ message ( $ file: $ line)</p> \n" ;
1610+ echo "<p> " . nl2br ( $ this -> htmlEncodeInternal ( $ message)). " ( " . $ this -> htmlEncodeInternal ( $ file). " : $ line)</p> \n" ;
16111611 echo '<pre> ' ;
16121612 $ trace =debug_backtrace ();
16131613 // skip the first 2 stacks as they are always irrelevant
@@ -1631,23 +1631,27 @@ public function displayError($code,$message,$file,$line)
16311631 else
16321632 {
16331633 echo "<h1>PHP Error [ $ code]</h1> \n" ;
1634- echo "<p> $ message</p> \n" ;
1634+ echo "<p> " . nl2br ( $ this -> htmlEncodeInternal ( $ message)). " </p> \n" ;
16351635 }
16361636 }
16371637 public function displayException ($ exception )
16381638 {
16391639 if (YII_DEBUG )
16401640 {
16411641 echo '<h1> ' .get_class ($ exception )."</h1> \n" ;
1642- echo '<p> ' .$ exception ->getMessage ().' ( ' .$ exception ->getFile ().': ' .$ exception ->getLine ().')</p> ' ;
1643- echo '<pre> ' .$ exception ->getTraceAsString ().'</pre> ' ;
1642+ echo '<p> ' .nl2br ( $ this -> htmlEncodeInternal ( $ exception ->getMessage ())) .' ( ' .$ this -> htmlEncodeInternal ( $ exception ->getFile () ).': ' .$ exception ->getLine ().')</p> ' ;
1643+ echo '<pre> ' .$ this -> htmlEncodeInternal ( $ exception ->getTraceAsString () ).'</pre> ' ;
16441644 }
16451645 else
16461646 {
16471647 echo '<h1> ' .get_class ($ exception )."</h1> \n" ;
1648- echo '<p> ' .$ exception ->getMessage ().'</p> ' ;
1648+ echo '<p> ' .nl2br ( $ this -> htmlEncodeInternal ( $ exception ->getMessage ()) ).'</p> ' ;
16491649 }
16501650 }
1651+ private function htmlEncodeInternal ($ string )
1652+ {
1653+ return htmlspecialchars ($ string , ENT_NOQUOTES | ENT_SUBSTITUTE | ENT_HTML5 , 'UTF-8 ' );
1654+ }
16511655 protected function initSystemHandlers ()
16521656 {
16531657 if (YII_ENABLE_EXCEPTION_HANDLER )
0 commit comments