Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/yiisoft/yii
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/yiisoft/yii:
  Fixes #3701: removed unclear docs leftover from phpdoc
  fixes #3696 with broken case insensitiveness for Active Record count expressions
  use display:none on hidden fields in CForm
  fixed test break
  Added a missing French translation for the string: "The format of {attribute} is invalid."
  Fixed . usage in Yii:t
  Added 1.1.16 upgrade note about controller namespaces
  Fixed version number
  prepare for next release.
  1.1.16 release.
  • Loading branch information
cebe committed Jan 10, 2015
2 parents e62e69e + 3a5473f commit a0bf9f1
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 35 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
Yii Framework Change Log
========================

Version 1.1.16 under development
Version 1.1.17 work in progress
-------------------------------

- Bug #3696: Fixed broken case insensitiveness for Active Record count expressions introduced with fixed #268 (xt99)
- Enh #3686: Wrapper div of hidden fields in CForm now have style `display:none` instead of `visibility:hidden` to not affect the layout (cebe, alaabadran)

Version 1.1.16 December 21, 2014
--------------------------------
- Bug #264: Fixed wrong timestamp precision value in postgres schema (nineinchnick)
- Bug #268: Fixed Active Record count error when some field name starting from 'count' (nineinchnick)
Expand Down
33 changes: 19 additions & 14 deletions UPGRADE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Upgrading Instructions for Yii Framework v1.1.16
Upgrading Instructions for Yii Framework v1.1.17
================================================

!!!IMPORTANT!!!
Expand All @@ -17,15 +17,11 @@ General upgrade instructions
- Check if everything is OK, if not — revert from backup and post
issues to Yii issue tracker.

Upgrading from v1.1.15
Upgrading from v1.1.16
----------------------

- jQuery was updated past version 1.9, which introduced important API changes. Check the
[upgrade guide](http://jquery.com/upgrade-guide/1.9/). The [jquery-migrate plugin](https://github.com/jquery/jquery-migrate/)
can help checking your code for deprecated functionality.

- jQueryUI was updated. Check the upgrade guides for [1.10](http://jqueryui.com/upgrade-guide/1.10) and
[1.11](http://jqueryui.com/upgrade-guide/1.11).
Upgrading from v1.1.15
----------------------

- CErrorHandler now runs errorAction for errors, which appear via AJAX request.
If you use CErrorHandler::errorAction, make sure it handles AJAX request properly.
Expand All @@ -41,20 +37,29 @@ Upgrading from v1.1.15

- We upgraded the bundled jQuery version to 1.11.1. Previous version was 1.8.3.
There were breaking changes in the jQuery API which you can find in the jQuery blog:
<http://jquery.com/upgrade-guide/1.9/#changes-of-note-in-jquery-1-9>
<http://jquery.com/upgrade-guide/1.9/#changes-of-note-in-jquery-1-9>. The [jquery-migrate plugin](https://github.com/jquery/jquery-migrate/)
can help checking your code for deprecated functionality.

- Use CSecurityManager::legacyDecrypt() and CSecurityManager::encrypt() to convert existing encrypted data if any.
- jQueryUI was updated. Check the upgrade guides for [1.10](http://jqueryui.com/upgrade-guide/1.10) and
[1.11](http://jqueryui.com/upgrade-guide/1.11).

- If there are exceptions about encryption key length you need to:
- The implementation of `CSecurityManager::encrypt()` and `decrypt()` were changed to be more secure.
The old implementations were renamed as `legacyEncrypt()` and `legacyDecrypt()`. If you use these methods to encrypt
your data, you should either call legacy versions now to avoid code break or take the following steps to use the new
version (which we highly recommend):

1. Decrypt all the data.
1. Decrypt existing data that were encrypted using `legacyDecrypt()`.
2. Change key via application config (encryptionKey property of securityManager component) to the one that conforms
to recommendations.
3. Encrypt all the data.
to recommendations.
3. Encrypt the data using `legacyEncrypt()`.

You can disable key validation by setting validateEncryptionKey property of securityManager component to false but
if it strongly not recommended.

- Namespaced controllers in subdirectories should now have subdirectory in namespace. Previously it was possible to
use the same namespace for both controllers in root directory and subdirectories.


Upgrading from v1.1.14
----------------------

Expand Down
2 changes: 1 addition & 1 deletion framework/YiiBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class YiiBase
*/
public static function getVersion()
{
return '1.1.16-dev';
return '1.1.17-dev';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion framework/base/CSecurityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ protected function validateEncryptionKey($key)
if($supportedKeyLengths)
{
if(!in_array($this->strlen($key),$supportedKeyLengths)) {
throw new CException(Yii::t('yii','Encryption key length can be {keyLengths}',array('{keyLengths}'=>implode(',',$supportedKeyLengths).'.')));
throw new CException(Yii::t('yii','Encryption key length can be {keyLengths}.',array('{keyLengths}'=>implode(',',$supportedKeyLengths))));
}
}
elseif(isset(self::$encryptionKeyMinimumLengths[$this->cryptAlgorithm]))
Expand Down
1 change: 0 additions & 1 deletion framework/base/CStatePersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
*
* CStatePersister is a core application component used to store global application state.
* It may be accessed via {@link CApplication::getStatePersister()}.
* page state persistent method based on cache.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @package system.base
Expand Down
2 changes: 1 addition & 1 deletion framework/db/ar/CActiveFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ public function count($criteria=null)
else
{
$select=is_array($criteria->select) ? implode(',',$criteria->select) : $criteria->select;
if($select!=='*' && preg_match('/^count\s*\(/',trim($select)))
if($select!=='*' && preg_match('/^count\s*\(/i',trim($select)))
$query->selects=array($select);
elseif(is_string($this->_table->primaryKey))
{
Expand Down
1 change: 1 addition & 0 deletions framework/messages/fr/yii.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
'The file "{file}" is too small. Its size cannot be smaller than {limit} bytes.' => 'Le fichier « {file} » est trop petit. Sa taille ne peut être inférieure à {limit} octets.',
'The file "{file}" was only partially uploaded.' => 'Le fichier « {file} » a été téléchargé partiellement.',
'The first element in a filter configuration must be the filter class.' => 'Le premier élément de la configuration d\'un filtre doit être la classe filtre.',
'The format of {attribute} is invalid.' => 'Le format de {attribute} est invalide.',
'The item "{name}" does not exist.' => 'L\'élément « {name} » est inexistant.',
'The item "{parent}" already has a child "{child}".' => 'L\'élément « {parent} » a déjà un enfant « {child} ».',
'The layout path "{path}" is not a valid directory.' => 'Le chemin d\'accès « {path} » au gabarit n\'est pas un dossier valide.',
Expand Down
4 changes: 2 additions & 2 deletions framework/web/form/CForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public function renderBegin()
$options['htmlOptions']=$this->attributes;
ob_start();
$this->_activeForm=$this->getOwner()->beginWidget($class, $options);
return ob_get_clean() . "<div style=\"visibility:hidden\">".CHtml::hiddenField($this->getUniqueID(),1)."</div>\n";
return ob_get_clean() . "<div style=\"display:none\">".CHtml::hiddenField($this->getUniqueID(),1)."</div>\n";
}
}

Expand Down Expand Up @@ -538,7 +538,7 @@ public function renderElement($element)
if($element instanceof CFormInputElement)
{
if($element->type==='hidden')
return "<div style=\"visibility:hidden\">\n".$element->render()."</div>\n";
return "<div style=\"display:none\">\n".$element->render()."</div>\n";
else
return "<div class=\"row field_{$element->name}\">\n".$element->render()."</div>\n";
}
Expand Down
38 changes: 27 additions & 11 deletions framework/yiilite.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class YiiBase
private static $_logger;
public static function getVersion()
{
return '1.1.16-dev';
return '1.1.16';
}
public static function createWebApplication($config=null)
{
Expand Down Expand Up @@ -1044,7 +1044,8 @@ public function setModules($modules,$merge=true)
{
if(!isset($module['class']))
{
Yii::setPathOfAlias($id,$this->getModulePath().DIRECTORY_SEPARATOR.$id);
if (Yii::getPathOfAlias($id)===false)
Yii::setPathOfAlias($id,$this->getModulePath().DIRECTORY_SEPARATOR.$id);
$module['class']=$id.'.'.ucfirst($id).'Module';
}
$this->_moduleConfig[$id]=$module;
Expand Down Expand Up @@ -2276,6 +2277,7 @@ class CHttpRequest extends CApplicationComponent
private $_preferredLanguages;
private $_csrfToken;
private $_restParams;
private $_httpVersion;
public function init()
{
parent::init();
Expand Down Expand Up @@ -2806,6 +2808,7 @@ public function sendFile($fileName,$content,$mimeType=null,$terminate=true)
$fileSize=(function_exists('mb_strlen') ? mb_strlen($content,'8bit') : strlen($content));
$contentStart=0;
$contentEnd=$fileSize-1;
$httpVersion=$this->getHttpVersion();
if(isset($_SERVER['HTTP_RANGE']))
{
header('Accept-Ranges: bytes');
Expand Down Expand Up @@ -2839,11 +2842,11 @@ public function sendFile($fileName,$content,$mimeType=null,$terminate=true)
header("Content-Range: bytes $contentStart-$contentEnd/$fileSize");
throw new CHttpException(416,'Requested Range Not Satisfiable');
}
header('HTTP/1.1 206 Partial Content');
header("HTTP/$httpVersion 206 Partial Content");
header("Content-Range: bytes $contentStart-$contentEnd/$fileSize");
}
else
header('HTTP/1.1 200 OK');
header("HTTP/$httpVersion 200 OK");
$length=$contentEnd-$contentStart+1; // Calculate new content length
header('Pragma: public');
header('Expires: 0');
Expand Down Expand Up @@ -2951,6 +2954,17 @@ public function validateCsrfToken($event)
throw new CHttpException(400,Yii::t('yii','The CSRF token could not be verified.'));
}
}
public function getHttpVersion()
{
if($this->_httpVersion===null)
{
if(isset($_SERVER['SERVER_PROTOCOL']) && $_SERVER['SERVER_PROTOCOL']==='HTTP/1.0')
$this->_httpVersion='1.0';
else
$this->_httpVersion='1.1';
}
return $this->_httpVersion;
}
}
class CCookieCollection extends CMap
{
Expand Down Expand Up @@ -4081,8 +4095,8 @@ public function runWithParams($params)
$method=new ReflectionMethod($this, 'run');
if($method->getNumberOfParameters()>0)
return $this->runWithParamsInternal($this, $method, $params);
else
return $this->run();
$this->run();
return true;
}
protected function runWithParamsInternal($object, $method, $params)
{
Expand Down Expand Up @@ -4122,8 +4136,8 @@ public function runWithParams($params)
$method=new ReflectionMethod($controller, $methodName);
if($method->getNumberOfParameters()>0)
return $this->runWithParamsInternal($controller, $method, $params);
else
return $controller->$methodName();
$controller->$methodName();
return true;
}
}
class CWebUser extends CApplicationComponent implements IWebUser
Expand Down Expand Up @@ -4570,7 +4584,8 @@ public function setSessionID($value)
}
public function regenerateID($deleteOldSession=false)
{
session_regenerate_id($deleteOldSession);
if($this->getIsStarted())
session_regenerate_id($deleteOldSession);
}
public function getSessionName()
{
Expand Down Expand Up @@ -5984,6 +5999,7 @@ public static function renderAttributes($htmlOptions)
'formnovalidate'=>1,
'hidden'=>1,
'ismap'=>1,
'itemscope'=>1,
'loop'=>1,
'multiple'=>1,
'muted'=>1,
Expand Down Expand Up @@ -8429,9 +8445,9 @@ public function __construct($model)
if(($table=$model->getDbConnection()->getSchema()->getTable($tableName))===null)
throw new CDbException(Yii::t('yii','The table "{table}" for active record class "{class}" cannot be found in the database.',
array('{class}'=>$this->_modelClassName,'{table}'=>$tableName)));
if($table->primaryKey===null)
if(($modelPk=$model->primaryKey())!==null || $table->primaryKey===null)
{
$table->primaryKey=$model->primaryKey();
$table->primaryKey=$modelPk;
if(is_string($table->primaryKey) && isset($table->columns[$table->primaryKey]))
$table->columns[$table->primaryKey]->isPrimaryKey=true;
elseif(is_array($table->primaryKey))
Expand Down
2 changes: 1 addition & 1 deletion framework/zii/widgets/grid/CGridView.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ public function renderTableRow($row)
*
* @param CGridColumn $column The Column instance to
* @param integer $row
* @since 1.1.17
* @since 1.1.16
*/
protected function renderDataCell($column, $row)
{
Expand Down
5 changes: 3 additions & 2 deletions tests/framework/i18n/CDateFormatterTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/**
* CDateFormatterTest
* @group i18n
*/
class CDateFormatterTest extends CTestCase
{
Expand Down Expand Up @@ -96,8 +97,8 @@ public function testTimeZones()
date_default_timezone_set('Etc/GMT+10');
$this->assertEquals('-10:00', Yii::app()->dateFormatter->format('ZZZZZ', time()));

date_default_timezone_set('Europe/Moscow');
$this->assertEquals('+03:00', Yii::app()->dateFormatter->format('ZZZZZ', time()));
date_default_timezone_set('Europe/Berlin');
$this->assertEquals(date('I') == '1' ? '+02:00' : '+01:00', Yii::app()->dateFormatter->format('ZZZZZ', time()));

date_default_timezone_set('America/Los_Angeles');
$this->assertEquals(date('I') == '1' ? '-07:00' : '-08:00', Yii::app()->dateFormatter->format('ZZZZZ', time()));
Expand Down

0 comments on commit a0bf9f1

Please sign in to comment.