Hello everyone,
The two versions I have (one for development and other production) tells me "Phalcon \ Mvc \ Dispatcher \ Exception: Dispatcher has detected a cyclic routing Causing stability problems"
in echo $ application-> handle () -> getContent (); from index.php
I know this error, but in this case not because I get.
I changed server from Apache to nginx-ubuntu-php-fpm-centos, and not if any settings that I've done wrong.
Error logs do not show me anything (nginx, php, web log).
How can I debug this error?
<?php
//phpinfo(); die();
//1. para entorno desarrollo
$debug = new \Phalcon\Debug();
$debug->listen();
//2. para entorno real dejamos el try-catch?
//try {
/**
* Define some useful constants
*/
define('BASE_DIR', dirname(__DIR__));
define('APP_DIR', BASE_DIR . '/app');
define('DOMINIO', isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost');
define('IP', isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0');
/**
* DEFINIMOS SI ESTAMOS EN ENTORNO DEV O PROUDCCIÓN
*/
if (!defined('DEV')) {
define('DEV', strpos(DOMINIO, "dev") !== false);
}
if (DEV) {
define('DEBUG', true);
error_reporting(E_ALL);
} else {
define('DEBUG', false);
}
/**
* Read the configuration
*/
$config = include APP_DIR . '/config/config.php';
/**
* Read auto-loader
*/
include APP_DIR . '/config/loader.php';
/**
* Read services
*/
include APP_DIR . '/config/services.php';
/**
* Handle the request
*/
$application = new \Phalcon\Mvc\Application($di);
//var_dump($application->handle()); die();
echo $application->handle()->getContent();
//} catch (Exception $e) {
// echo $e->getMessage(), '<br>';
// echo nl2br(htmlentities($e->getTraceAsString()));
//}
index.php
class ControllerBase extends Controller
{
//public function initialize()
//{
// \Phalcon\Tag::setTitle('Colindar | ');
//}
/**
* Execute before the router so we can determine if this is a provate controller, and must be authenticated, or a
* public controller that is open to all.
*
* @param Dispatcher $dispatcher
* @return boolean
*/
public function beforeExecuteRoute(Dispatcher $dispatcher){
$controllerName = $dispatcher->getControllerName();
// Only check permissions on private controllers
if ($this->acl->isPrivate($controllerName)) {
// Get the current identity
$identity = $this->auth->getIdentity();
// If there is no identity available the user is redirected to index/index
if (!is_array($identity)) {
$this->flash->notice('Su sesión ha caducado, por políticas de seguridad pasado un tiempo de inactividad el sistema se desloguea automáticamente');
$dispatcher->forward(array(
'controller' => 'session',
'action' => 'login'
));
return false;
}
// Check if the user have permission to the current option
$actionName = $dispatcher->getActionName();
if (!$this->acl->isAllowed($identity['profile'], $controllerName, $actionName)) {
$this->flash->notice('No tienes acceso a esta acción: ' . $controllerName . ':' . $actionName);
//if ($this->acl->isAllowed($identity['profile'], $controllerName, 'index')) {
// $dispatcher->forward(array(
// 'controller' => $controllerName,
// 'action' => 'index',
// ));
//} else {
// $dispatcher->forward(array(
// 'controller' => 'user_control',
// 'action' => 'index',
// ));
//}
//var_dump("beforeExecuteRoute"); die();
$controllerSession = $this->session->get('namespace');
$dispatcher->forward(array(
'controller' => $controllerSession,
'action' => 'index',
));
return FALSE;
} else {
//como está logueado y tiene acceso hacemos lo siguiente
$user = $this->auth->getUser();
$this->view->user = $user;
}
}
//var_dump($this->acl->isPrivate($controllerName)); die();
}
/**
* Go Back from whence you came
* @return type
*/
protected function _redirectBack() {
return $this->response->redirect($this->request->getHTTPReferer());
}
}
controllerBase.php
I need help! :)