Skip to content

Commit

Permalink
Fix a number of errors with PHP 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 28, 2011
1 parent 482e487 commit 9950af8
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 5 deletions.
3 changes: 2 additions & 1 deletion cake/config/config.php
Expand Up @@ -17,4 +17,5 @@
* @since CakePHP(tm) v 1.1.11.4062
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
return $config['Cake.version'] = '1.3.13';
$config['Cake.version'] = '1.3.13';
return $config;
5 changes: 4 additions & 1 deletion cake/libs/debugger.php
Expand Up @@ -629,7 +629,10 @@ function _output($data = array()) {
$data += $defaults;

$files = $this->trace(array('start' => 2, 'format' => 'points'));
$code = $this->excerpt($files[0]['file'], $files[0]['line'] - 1, 1);
$code = '';
if (isset($files[0]['file'])) {
$code = $this->excerpt($files[0]['file'], $files[0]['line'] - 1, 1);
}
$trace = $this->trace(array('start' => 2, 'depth' => '20'));
$insertOpts = array('before' => '{:', 'after' => '}');
$context = array();
Expand Down
3 changes: 3 additions & 0 deletions cake/libs/model/cake_schema.php
Expand Up @@ -557,6 +557,9 @@ function _arrayDiffAssoc($array1, $array2) {
$difference[$key] = $value;
continue;
}
if (is_array($value) && is_array($correspondingValue)) {
continue;
}
$compare = strval($value);
$correspondingValue = strval($correspondingValue);
if ($compare === $correspondingValue) {
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/multibyte.php
Expand Up @@ -1047,7 +1047,7 @@ function mimeEncode($string, $charset = null, $newline = "\r\n") {
$parts = array();
$maxchars = floor(($length * 3) / 4);
while (strlen($string) > $maxchars) {
$i = $maxchars;
$i = (int)$maxchars;
$test = ord($string[$i]);
while ($test >= 128 && $test <= 191) {
$i--;
Expand Down
9 changes: 8 additions & 1 deletion cake/libs/router.php
Expand Up @@ -948,7 +948,14 @@ function _handleNoRoute($url) {

if (!empty($named)) {
foreach ($named as $name => $value) {
$output .= '/' . $name . $this->named['separator'] . $value;
if (is_array($value)) {
$flattend = Set::flatten($value, '][');
foreach ($flattend as $namedKey => $namedValue) {
$output .= '/' . $name . "[$namedKey]" . $this->named['separator'] . $namedValue;
}
} else {
$output .= '/' . $name . $this->named['separator'] . $value;
}
}
}
return $output;
Expand Down
3 changes: 3 additions & 0 deletions cake/libs/set.php
Expand Up @@ -704,6 +704,9 @@ function insert($list, $path, $data = null) {
}
$_list =& $_list[$key];
}
if (!is_array($_list)) {
return array();
}
}
return $list;
}
Expand Down
1 change: 1 addition & 0 deletions cake/tests/cases/console/libs/tasks/fixture.test.php
Expand Up @@ -74,6 +74,7 @@ function startTest() {
$this->Dispatcher =& new TestFixtureTaskMockShellDispatcher();
$this->Task =& new MockFixtureTask();
$this->Task->Model =& new MockFixtureModelTask();
$this->Task->DbConfig =& new MockFixtureModelTask();
$this->Task->Dispatch =& $this->Dispatcher;
$this->Task->Template =& new TemplateTask($this->Task->Dispatch);
$this->Task->Dispatch->shellPaths = App::path('shells');
Expand Down
1 change: 1 addition & 0 deletions cake/tests/cases/console/libs/tasks/view.test.php
Expand Up @@ -260,6 +260,7 @@ function startTest() {
$this->Task->Template =& new TemplateTask($this->Dispatcher);
$this->Task->Controller =& new ViewTaskMockControllerTask();
$this->Task->Project =& new ViewTaskMockProjectTask();
$this->Task->DbConfig =& new ViewTaskMockProjectTask();
$this->Task->path = TMP;
$this->Task->Template->params['theme'] = 'default';

Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/model/model_write.test.php
Expand Up @@ -2674,7 +2674,7 @@ function testSaveAllHabtm() {
$this->assertEqual(count($result['Tag']), 2);
$this->assertEqual($result['Tag'][0]['tag'], 'tag1');
$this->assertEqual(count($result['Comment']), 1);
$this->assertEqual(count($result['Comment'][0]['comment']['Article comment']), 1);
$this->assertEqual(count($result['Comment'][0]['comment']), 1);
}

/**
Expand Down

0 comments on commit 9950af8

Please sign in to comment.