Question

When I use themed view in my app based on CakePHP 1.2.10 it gives the following symptoms:

  1. The favicon does not printed out in the source.
  2. the following warning are generated:

    Warning (2): array_merge() [function.array-merge]: Argument #2 is not an array [ROOT\cakephp\cake\libs\router.php, line 754]

    Warning (2): extract() expects parameter 1 to be array, null given [ROOT\cakephp\cake\libs\router.php, line 754]

    Notice (8): Undefined variable: escape [ROOT\cakephp\cake\libs\router.php, line 930]

All of these warnings and notice mention to:

[main] - APP\webroot\index.php, line 87

The line 87 of that file is in the following code

if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') {
        return;
    } else {
        $Dispatcher = new Dispatcher(); 
        $Dispatcher->dispatch($url);//This is line 87
    }
    if (Configure::read() > 0) {
        echo "<!-- " . round(getMicrotime() - $TIME_START, 4) . "s -->";
    }
//Here is the end of the file APP\webroot\index.php
?>

My app includes the CakePHP library out from the application directory. i.e one cake for all of my apps.

All of this warnings are disappeared when I switch to the non-themed view. I wonder why I got those warnings? and how could I fix them.

Was it helpful?

Solution

I found that this error is due to wrong call for $html->url() method. I was call it as $this->url('/img/logo.png', "full"), but it should be $html->url('/img/logo.png', true).

The call came from an element file called head.ctp. the following is the full contest warning explaonation:

array_merge - [internal], line ??
Router::url() - ROOT\cakephp\cake\libs\router.php, line 754
Helper::url() - ROOT\cakephp\cake\libs\view\helper.php, line 177
include - APP\views\themed\slate\elements\head.ctp, line 15 //HERE IS THE Mistaken Call
View::_render() - ROOT\cakephp\cake\libs\view\view.php, line 665
View::element() - ROOT\cakephp\cake\libs\view\view.php, line 342
include - APP\views\themed\slate\layouts\blog.ctp, line 1
View::_render() - ROOT\cakephp\cake\libs\view\view.php, line 665
View::renderLayout() - ROOT\cakephp\cake\libs\view\view.php, line 453
View::render() - ROOT\cakephp\cake\libs\view\view.php, line 387
Controller::render() - ROOT\cakephp\cake\libs\controller\controller.php, line 808
Dispatcher::_invoke() - ROOT\cakephp\cake\dispatcher.php, line 229
Dispatcher::dispatch() - ROOT\cakephp\cake\dispatcher.php, line 193
[main] - APP\webroot\index.php, line 88
Warning (2): extract() expects parameter 1 to be array, null given [ROOT\cakephp\cake\libs\router.php, line 754]
Notice (8): Undefined variable: escape [ROOT\cakephp\cake\libs\router.php, line 930
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top