Skip to content

Commit

Permalink
Updating for PHP5.4
Browse files Browse the repository at this point in the history
- Fixing strict errors.
- Fixing call time pass by reference as its been removed in PHP5.4
- Fix assign new as a reference, which has been removed.
  • Loading branch information
markstory committed Nov 13, 2011
1 parent 0c0bb60 commit 0a0a099
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 50 deletions.
3 changes: 2 additions & 1 deletion lib/Cake/Console/Command/CommandListShell.php
Expand Up @@ -81,7 +81,8 @@ public function main() {
protected function _getShellList() {
$shellList = array();

$shells = App::objects('file', App::core('Console/Command'));
$corePath = App::core('Console/Command');
$shells = App::objects('file', $corePath[0]);
$shellList = $this->_appendShells('CORE', $shells, $shellList);

$appShells = App::objects('Console/Command', null, false);
Expand Down
7 changes: 4 additions & 3 deletions lib/Cake/Model/CakeSchema.php
Expand Up @@ -546,9 +546,10 @@ protected function _arrayDiffAssoc($array1, $array2) {
$difference[$key] = $value;
continue;
}
$compare = strval($value);
$correspondingValue = strval($correspondingValue);
if ($compare === $correspondingValue) {
if (is_array($value) && is_array($correspondingValue)) {
continue;
}
if ($value === $correspondingValue) {
continue;
}
$difference[$key] = $value;
Expand Down
25 changes: 4 additions & 21 deletions lib/Cake/Test/Case/Controller/ComponentTest.php
Expand Up @@ -40,23 +40,6 @@ class ParamTestComponent extends Component {
* @var array
*/
public $components = array('Banana' => array('config' => 'value'));

/**
* initialize method
*
* @param mixed $controller
* @param mixed $settings
* @return void
*/
public function initialize(&$controller, $settings) {
foreach ($settings as $key => $value) {
if (is_numeric($key)) {
$this->{$value} = true;
} else {
$this->{$key} = $value;
}
}
}
}

/**
Expand Down Expand Up @@ -109,7 +92,7 @@ class AppleComponent extends Component {
* @param mixed $controller
* @return void
*/
public function startup(&$controller) {
public function startup($controller) {
$this->testName = $controller->name;
}
}
Expand All @@ -134,7 +117,7 @@ class OrangeComponent extends Component {
* @param mixed $controller
* @return void
*/
public function initialize(&$controller) {
public function initialize($controller) {
$this->Controller = $controller;
$this->Banana->testField = 'OrangeField';
}
Expand All @@ -145,7 +128,7 @@ public function initialize(&$controller) {
* @param Controller $controller
* @return string
*/
public function startup(&$controller) {
public function startup($controller) {
$controller->foo = 'pass';
}
}
Expand All @@ -170,7 +153,7 @@ class BananaComponent extends Component {
* @param Controller $controller
* @return string
*/
public function startup(&$controller) {
public function startup($controller) {
$controller->bar = 'fail';
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Controller/ControllerTest.php
Expand Up @@ -102,7 +102,7 @@ public function beforeFind($query) {
* @param array $options
* @return void
*/
public function find($type, $options = array()) {
public function find($type = 'first', $options = array()) {
if ($type == 'popular') {
$conditions = array($this->name . '.' . $this->primaryKey .' > ' => '1');
$options = Set::merge($options, compact('conditions'));
Expand Down
9 changes: 0 additions & 9 deletions lib/Cake/Test/Case/Controller/PagesControllerTest.php
Expand Up @@ -26,15 +26,6 @@
*/
class PagesControllerTest extends CakeTestCase {

/**
* endTest method
*
* @return void
*/
public function endTest() {
App::build();
}

/**
* testDisplay method
*
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Test/Case/Controller/ScaffoldTest.php
Expand Up @@ -87,12 +87,12 @@ public function beforeScaffold($method) {
class TestScaffoldMock extends Scaffold {

/**
* Overload __scaffold
* Overload _scaffold
*
* @param unknown_type $params
*/
function _scaffold($params) {
$this->_params = $params;
function _scaffold(CakeRequest $request) {
$this->_params = $request;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Error/ExceptionRendererTest.php
Expand Up @@ -64,7 +64,7 @@ class BlueberryComponent extends Component {
*
* @return void
*/
public function initialize(&$controller) {
public function initialize($controller) {
$this->testName = 'BlueberryComponent';
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
Expand Up @@ -3305,9 +3305,9 @@ public function testResetAddedAssociation() {

$this->assertTrue(empty($this->Article->hasMany['ArticlesTag']));

$this->JoinA =& ClassRegistry::init('JoinA');
$this->JoinB =& ClassRegistry::init('JoinB');
$this->JoinC =& ClassRegistry::init('JoinC');
$this->JoinA = ClassRegistry::init('JoinA');
$this->JoinB = ClassRegistry::init('JoinB');
$this->JoinC = ClassRegistry::init('JoinC');

$this->JoinA->Behaviors->attach('Containable');
$this->JoinB->Behaviors->attach('Containable');
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Model/CakeSchemaTest.php
Expand Up @@ -955,7 +955,7 @@ public function testTableParametersAndIndexComparison() {
)
)
);
$this->assertEqual($compare, $expected);
$this->assertEquals($expected, $compare);
}

/**
Expand Down
Expand Up @@ -43,7 +43,7 @@ class DboPostgresTestDb extends Postgres {
* @param mixed $sql
* @return void
*/
function _execute($sql, $params = array()) {
function _execute($sql, $params = array(), $prepareOptions = array()) {
$this->simulated[] = $sql;
return null;
}
Expand Down
Expand Up @@ -42,7 +42,7 @@ class DboSqliteTestDb extends Sqlite {
* @param mixed $sql
* @return void
*/
function _execute($sql, $params = array()) {
function _execute($sql, $params = array(), $prepareOptions = array()) {
$this->simulated[] = $sql;
return null;
}
Expand Down
Expand Up @@ -48,9 +48,11 @@ class SqlserverTestDb extends Sqlserver {
* execute method
*
* @param mixed $sql
* @param mixed $params
* @param mixed $prepareOptions
* @return mixed
*/
protected function _execute($sql) {
protected function _execute($sql, $params = array(), $prepareOptions = array()) {
$this->simulated[] = $sql;
return empty($this->executeResultsStack) ? null : array_pop($this->executeResultsStack);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
Expand Up @@ -33,10 +33,10 @@ public function connect($config = array()) {
}

public function mergeAssociation(&$data, &$merge, $association, $type, $selfJoin = false) {
return parent::_mergeAssociation(&$data, &$merge, $association, $type, $selfJoin);
return parent::_mergeAssociation($data, $merge, $association, $type, $selfJoin);
}

public function setConfig($config) {
public function setConfig($config = array()) {
$this->config = $config;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/Case/Network/Http/DigestAuthenticationTest.php
Expand Up @@ -35,7 +35,7 @@ class DigestHttpSocket extends HttpSocket {
* @param mixed $request
* @return void
*/
public function request($request) {
public function request($request = array()) {
if ($request === false) {
if (isset($this->response['header']['WWW-Authenticate'])) {
unset($this->response['header']['WWW-Authenticate']);
Expand Down Expand Up @@ -192,4 +192,4 @@ public function testNoDigestResponse() {
$this->assertFalse(isset($this->HttpSocket->request['header']['Authorization']));
}

}
}
2 changes: 2 additions & 0 deletions lib/Cake/Test/Case/View/Helper/SessionHelperTest.php
Expand Up @@ -42,6 +42,7 @@ public function setUp() {

if (!CakeSession::started()) {
CakeSession::start();
var_dump('session was not started');
}

$_SESSION = array(
Expand Down Expand Up @@ -70,6 +71,7 @@ public function setUp() {
),
'Deeply' => array('nested' => array('key' => 'value')),
);
var_dump($_SESSION);
}

/**
Expand Down

0 comments on commit 0a0a099

Please sign in to comment.