@@ -41,7 +41,7 @@ class YiiBase
41
41
private static $ _logger ;
42
42
public static function getVersion ()
43
43
{
44
- return '1.1.31-dev ' ;
44
+ return '1.1.31 ' ;
45
45
}
46
46
public static function createWebApplication ($ config =null )
47
47
{
@@ -1607,7 +1607,7 @@ public function displayError($code,$message,$file,$line)
1607
1607
if (YII_DEBUG )
1608
1608
{
1609
1609
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" ;
1611
1611
echo '<pre> ' ;
1612
1612
$ trace =debug_backtrace ();
1613
1613
// skip the first 2 stacks as they are always irrelevant
@@ -1631,23 +1631,27 @@ public function displayError($code,$message,$file,$line)
1631
1631
else
1632
1632
{
1633
1633
echo "<h1>PHP Error [ $ code]</h1> \n" ;
1634
- echo "<p> $ message</p> \n" ;
1634
+ echo "<p> " . nl2br ( $ this -> htmlEncodeInternal ( $ message)). " </p> \n" ;
1635
1635
}
1636
1636
}
1637
1637
public function displayException ($ exception )
1638
1638
{
1639
1639
if (YII_DEBUG )
1640
1640
{
1641
1641
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> ' ;
1644
1644
}
1645
1645
else
1646
1646
{
1647
1647
echo '<h1> ' .get_class ($ exception )."</h1> \n" ;
1648
- echo '<p> ' .$ exception ->getMessage ().'</p> ' ;
1648
+ echo '<p> ' .nl2br ( $ this -> htmlEncodeInternal ( $ exception ->getMessage ()) ).'</p> ' ;
1649
1649
}
1650
1650
}
1651
+ private function htmlEncodeInternal ($ string )
1652
+ {
1653
+ return htmlspecialchars ($ string , ENT_NOQUOTES | ENT_SUBSTITUTE | ENT_HTML5 , 'UTF-8 ' );
1654
+ }
1651
1655
protected function initSystemHandlers ()
1652
1656
{
1653
1657
if (YII_ENABLE_EXCEPTION_HANDLER )
0 commit comments