@@ -41,7 +41,7 @@ class YiiBase
41
41
private static $ _logger ;
42
42
public static function getVersion ()
43
43
{
44
- return '1.1.28-dev ' ;
44
+ return '1.1.28 ' ;
45
45
}
46
46
public static function createWebApplication ($ config =null )
47
47
{
@@ -2553,9 +2553,22 @@ protected function decodePathInfo($pathInfo)
2553
2553
}
2554
2554
else
2555
2555
{
2556
- return utf8_encode ($ pathInfo );
2556
+ return $ this -> utf8Encode ($ pathInfo );
2557
2557
}
2558
2558
}
2559
+ private function utf8Encode ($ s )
2560
+ {
2561
+ $ s .=$ s ;
2562
+ $ len =strlen ($ s );
2563
+ for ($ i =$ len >>1 ,$ j =0 ; $ i <$ len ; ++$ i ,++$ j ) {
2564
+ switch (true ) {
2565
+ case $ s [$ i ] < "\x80" : $ s [$ j ] = $ s [$ i ]; break ;
2566
+ case $ s [$ i ] < "\xC0" : $ s [$ j ] = "\xC2" ; $ s [++$ j ] = $ s [$ i ]; break ;
2567
+ default : $ s [$ j ] = "\xC3" ; $ s [++$ j ] = chr (ord ($ s [$ i ]) - 64 ); break ;
2568
+ }
2569
+ }
2570
+ return substr ($ s , 0 , $ j );
2571
+ }
2559
2572
public function getRequestUri ()
2560
2573
{
2561
2574
if ($ this ->_requestUri ===null )
@@ -4326,7 +4339,7 @@ public function logout($destroySession=true)
4326
4339
if ($ this ->identityCookie !==null )
4327
4340
{
4328
4341
$ cookie =$ this ->createIdentityCookie ($ this ->getStateKeyPrefix ());
4329
- $ cookie ->value =null ;
4342
+ $ cookie ->value ='' ;
4330
4343
$ cookie ->expire =0 ;
4331
4344
Yii::app ()->getRequest ()->getCookies ()->add ($ cookie ->name ,$ cookie );
4332
4345
}
@@ -5915,7 +5928,7 @@ public static function listData($models,$valueField,$textField,$groupField='')
5915
5928
public static function value ($ model ,$ attribute ,$ defaultValue =null )
5916
5929
{
5917
5930
if (is_scalar ($ attribute ) || $ attribute ===null )
5918
- foreach (explode ('. ' ,$ attribute ) as $ name )
5931
+ foreach (explode ('. ' ,( string ) $ attribute ) as $ name )
5919
5932
{
5920
5933
if (is_object ($ model ))
5921
5934
{
@@ -10443,9 +10456,9 @@ protected function validateAttribute($object,$attribute)
10443
10456
return ;
10444
10457
}
10445
10458
if (function_exists ('mb_strlen ' ) && $ this ->encoding !==false )
10446
- $ length =mb_strlen ($ value , $ this ->encoding ? $ this ->encoding : Yii::app ()->charset );
10459
+ $ length =mb_strlen (( string ) $ value , $ this ->encoding ? $ this ->encoding : Yii::app ()->charset );
10447
10460
else
10448
- $ length =strlen ($ value );
10461
+ $ length =strlen (( string ) $ value );
10449
10462
if ($ this ->min !==null && $ length <$ this ->min )
10450
10463
{
10451
10464
$ message =$ this ->tooShort !==null ?$ this ->tooShort :Yii::t ('yii ' ,'{attribute} is too short (minimum is {min} characters). ' );
0 commit comments