mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.4
Conflicts: lib/Cake/VERSION.txt
This commit is contained in:
commit
19f8274a95
13 changed files with 49 additions and 22 deletions
|
@ -312,7 +312,7 @@
|
|||
* By default File is used, but for improved performance you should use APC.
|
||||
*
|
||||
* Note: 'default' and other application caches should be configured in app/Config/bootstrap.php.
|
||||
* Please check the comments in boostrap.php for more info on the cache engines available
|
||||
* Please check the comments in bootstrap.php for more info on the cache engines available
|
||||
* and their settings.
|
||||
*/
|
||||
$engine = 'File';
|
||||
|
|
|
@ -303,7 +303,7 @@
|
|||
* By default File is used, but for improved performance you should use APC.
|
||||
*
|
||||
* Note: 'default' and other application caches should be configured in app/Config/bootstrap.php.
|
||||
* Please check the comments in boostrap.php for more info on the cache engines available
|
||||
* Please check the comments in bootstrap.php for more info on the cache engines available
|
||||
* and their settings.
|
||||
*/
|
||||
$engine = 'File';
|
||||
|
|
|
@ -31,8 +31,14 @@ foreach ($paths as $path) {
|
|||
}
|
||||
|
||||
if (!$found) {
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
if (!include $root . $ds . $dispatcher) {
|
||||
$rootInstall = dirname(dirname(dirname(__FILE__))) . $ds . $dispatcher;
|
||||
$composerInstall = dirname(dirname(__FILE__)) . $ds. $dispatcher;
|
||||
|
||||
if (file_exists($composerInstall)) {
|
||||
include $composerInstall;
|
||||
} elseif (file_exists($rootInstall)) {
|
||||
include $rootInstall;
|
||||
} else {
|
||||
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -49,12 +49,12 @@ class FormAuthenticate extends BaseAuthenticate {
|
|||
if (empty($request->data[$model])) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
empty($request->data[$model][$fields['username']]) ||
|
||||
empty($request->data[$model][$fields['password']])
|
||||
) {
|
||||
foreach (array($fields['username'], $fields['password']) as $field) {
|
||||
$value = $request->data($model . '.' . $field);
|
||||
if (empty($value) || !is_string($value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -539,7 +539,7 @@ class TranslateBehavior extends ModelBehavior {
|
|||
$className = $Model->translateModel;
|
||||
}
|
||||
|
||||
$this->runtime[$Model->alias]['model'] = ClassRegistry::init($className, 'Model');
|
||||
$this->runtime[$Model->alias]['model'] = ClassRegistry::init($className);
|
||||
}
|
||||
if (!empty($Model->translateTable) && $Model->translateTable !== $this->runtime[$Model->alias]['model']->useTable) {
|
||||
$this->runtime[$Model->alias]['model']->setSource($Model->translateTable);
|
||||
|
|
|
@ -86,8 +86,7 @@ class ConnectionManager {
|
|||
}
|
||||
|
||||
if (!empty(self::$_dataSources[$name])) {
|
||||
$return = self::$_dataSources[$name];
|
||||
return $return;
|
||||
return self::$_dataSources[$name];
|
||||
}
|
||||
|
||||
if (empty(self::$_connectionsEnum[$name])) {
|
||||
|
|
|
@ -1694,6 +1694,8 @@ class Model extends Object implements CakeEventListener {
|
|||
}
|
||||
}
|
||||
|
||||
$db = $this->getDataSource();
|
||||
|
||||
if (empty($this->data[$this->alias][$this->primaryKey])) {
|
||||
unset($this->data[$this->alias][$this->primaryKey]);
|
||||
}
|
||||
|
|
|
@ -115,6 +115,28 @@ class FormAuthenticateTest extends CakeTestCase {
|
|||
$this->assertFalse($this->auth->authenticate($request, $this->response));
|
||||
}
|
||||
|
||||
/**
|
||||
* test authenticate field is not string
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAuthenticateFieldsAreNotString() {
|
||||
$request = new CakeRequest('posts/index', false);
|
||||
$request->data = array(
|
||||
'User' => array(
|
||||
'user' => array('mariano', 'phpnut'),
|
||||
'password' => 'my password'
|
||||
));
|
||||
$this->assertFalse($this->auth->authenticate($request, $this->response));
|
||||
|
||||
$request->data = array(
|
||||
'User' => array(
|
||||
'user' => 'mariano',
|
||||
'password' => array('password1', 'password2')
|
||||
));
|
||||
$this->assertFalse($this->auth->authenticate($request, $this->response));
|
||||
}
|
||||
|
||||
/**
|
||||
* test the authenticate method
|
||||
*
|
||||
|
|
|
@ -7765,7 +7765,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
$this->assertEquals(4, $result[0][0]['other_field']);
|
||||
|
||||
ClassRegistry::flush();
|
||||
$Writing = ClassRegistry::init(array('class' => 'Post', 'alias' => 'Writing'), 'Model');
|
||||
$Writing = ClassRegistry::init(array('class' => 'Post', 'alias' => 'Writing'));
|
||||
$Writing->virtualFields = array('two' => "1 + 1");
|
||||
$result = $Writing->find('first');
|
||||
$this->assertEquals(2, $result['Writing']['two']);
|
||||
|
|
|
@ -2328,7 +2328,6 @@ class FormHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testInputTimeWithIntervalAnd12HourFormat() {
|
||||
/*
|
||||
$result = $this->Form->input('Model.start_time', array(
|
||||
'type' => 'time',
|
||||
'timeFormat' => 12,
|
||||
|
@ -2348,7 +2347,6 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertContains('<option value="04" selected="selected">4</option>', $result);
|
||||
$this->assertContains('<option value="30" selected="selected">30</option>', $result);
|
||||
$this->assertContains('<option value="pm" selected="selected">pm</option>', $result);
|
||||
*/
|
||||
|
||||
$result = $this->Form->input('Model.start_time', array(
|
||||
'type' => 'time',
|
||||
|
|
|
@ -73,7 +73,7 @@ class ClassRegistry {
|
|||
* Examples
|
||||
* Simple Use: Get a Post model instance ```ClassRegistry::init('Post');```
|
||||
*
|
||||
* Expanded: ```array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry', 'type' => 'Model');```
|
||||
* Expanded: ```array('class' => 'ClassName', 'alias' => 'AliasNameStoredInTheRegistry');```
|
||||
*
|
||||
* Model Classes can accept optional ```array('id' => $id, 'table' => $table, 'ds' => $ds, 'alias' => $alias);```
|
||||
*
|
||||
|
|
|
@ -421,7 +421,7 @@ class Debugger {
|
|||
}
|
||||
|
||||
/**
|
||||
* Wraps the highlight_string funciton in case the server API does not
|
||||
* Wraps the highlight_string function in case the server API does not
|
||||
* implement the function as it is the case of the HipHop interpreter
|
||||
*
|
||||
* @param string $str the string to convert
|
||||
|
|
Loading…
Reference in a new issue