We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Strange error: some views don't load after update.

Hi, I've been trying to find the cause of this error for a pretty long time and will be grateful for any advice or hint.

Some views on my test application don't load anymore after last app update, while others keep working. No error is thrown by framework itself or php or web server.

More strange that I haven't changed application structure where non loading views reside. The 'broken chain'( controller, action name and view) is the same as in previous version, and in previous version everything was fine.

And even more strange that current version have this problem with views on test servers (I’ve updated two machines: Cent Os and RedHat Phalcon 2.0.9 and 2.0.8, apache 2.4 php 5.5 and php 5.6) while on developers server(Mac Phalcon 2.0.8 apache 2.4 php 5.5) latest version works well. I’ve checked all necessary filesystem permissions and http.conf on both servers looks ok.

I’ve figured out that if I explicitly assign ‘broken’ view names

$this -> view -> pick

from controller action all works like a charm again. But aside from this work around I don’t know how to address this problem or even changes in which module should be blamed for that. In other words I'm stuck.

edited Nov '15

I had the same issue... and i discover its something about server- if u try to copy the project on other server (hosting): on the first will not work, on second- probably yes. In my case- i work on localhost. When u publish the project- this issue appear. The view layout works but content part didnt put correctly- and the fun part- it is not for all pages in project, just for a few. I never figure out what is the problem. So one day i deside to copy the project on my hosting (not localhost, with same PHP, phalcon, mysql version and etc) - and guess what- everything is working perfectly. So- i think is some kind of Server/Hosting configuration... but no idea what it is.

To work views in my case i was forced to do something like this (in the controller-actions where view didnt showed correctly):

        $view = clone $this->view;
        $view->start();
        $view->render('events', 'index');
        $view->finish();
        $content = $view->getContent();
        echo $content; exit;
edited Nov '15

Hi, Boris. In my case the described behaviour were caused by wrong case in urls: e.g

'/Controller/action'

insead of

'/controller/action'

I had had this in some cases, because of dynamic link generation based on model type.

I can understand the absence of any error (technically the view shouldn't necessarily follow the action). I was baffled by the fact that it worked on Mac and not worked on Redhat. That made me spent a bunch of time checking config and file level access firewall and so on. Nevertheless urls with capital letters were just working on developer's machine localhost which in my case is MacOsx but was not about the OS.

Well... your issue was same as mine xD i mean- i check my router and BOOM - i was making same mistake with controller names.

Small upd: Actually it works on Mac because mac unlike linux has case insensitive urls.

...on windows too :)