-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.0.1] The argument is not initialized or iterable() in phalcon/mvc/view.zep #12355
Comments
Just only this code is causing a problem ? Works fine for me. On php 7 and debian. |
Just get rid of Windows (acting as an application server), it'll work fine on GNU/Linux (at least VM). |
@ss56806298 Could you please provide detailed error log? |
@stamster
|
|
It could be that View::getViewsDirs() isn't returning an array, as is required in View::_engineRender(). Perhaps if View::setViewsDir() isn't used? @ss56806298 if you haven't used View::setViewsDir(), could you try building Phalcon (using Zephir) from https://github.com/SidRoberts/cphalcon/tree/possible-fix-12355 to see if that fixes the problem? |
If there would be script fully reproduce a problem then it would be good and we could now for sure what is causing it. |
@SidRoberts @Jurigag $application = new \Phalcon\Mvc\application($di);
echo $application->handle()->getContent(); The variable $di just defined at the top of this page. LoginController.php class LoginController extends ControllerBase {
public function checkAction() {
try{
$response = 1;
$this->sendResponse($response);
} catch(\Exception $e){
throw $e;
}
}
} ControllerBase.php use Phalcon\Mvc\Controller;
class ControllerBase extends Controller{
protected function sendResponse($response) {
$this->response->setStatusCode(200, 'OK');
$this->response->setHeader("Content-Type", "application/octet-stream");
$this->response->setHeader("X-Content-Type-Options", "nosniff");
$this->response->setContent($content);
$this->response->send();
}
} ControllerBase.php after i modified class ControllerBase extends Controller{
protected function sendResponse($response) {
$this->view->disable();
$this->response->setStatusCode(200, 'OK');
$this->response->setHeader("Content-Type", "application/octet-stream");
$this->response->setHeader("X-Content-Type-Options", "nosniff");
$this->response->setContent($content);
$this->response->send();
}
} It seems that the lastest version of phalcon changed at the view. |
I have encountered the same problem in Debian. As I found, the problem was in |
Returning a response from the controller won't render a view (so you won't have to disable it): class ControllerBase extends Controller
{
protected function generateResponse($content)
{
$this->response->setStatusCode(200, 'OK');
$this->response->setHeader("Content-Type", "application/octet-stream");
$this->response->setHeader("X-Content-Type-Options", "nosniff");
$this->response->setContent($content);
return $this->response;
}
} class LoginController extends ControllerBase
{
public function checkAction()
{
try {
$response = 1;
return $this->generateResponse($response);
} catch (\Exception $e) {
throw $e;
}
}
} |
Exactly, just imho always return something from controller action. |
@SidRoberts It is fixed in |
Yes (eca6ee1). |
After I updated my phalcon from 2.0.X to 3.0.1,the error occured.And when i turned the version back,it runned normally.I'm not sured where the error happened.
Details
The text was updated successfully, but these errors were encountered: