Invalid controller specified (error) when trying Propel Query - php

I've added the Propel ORM to my Zend Framework project.
The following files are under my /application/configs folder:
application.ini
build.properties
classmap-gentsefeesten-conf.php
gentsefeesten-conf.php
runtime-conf.xml
schema.xml
Under /application/models I have:
gentsefeesten
map
om
query's
I work with modules so I have a modules folder with two folders in it (my modules).
In my "index.php" file I've added the following: (third rule)
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
realpath(APPLICATION_PATH . '/models'),//propel
get_include_path(),
)));
So the application gets my models in my models folder.
But I always get the following error :
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in /Applications/MAMP/htdocs/GentseFeesten/library/Zend/Controller/Dispatcher/Standard.php:248
Stack trace:
#0 /Applications/MAMP/htdocs/GentseFeesten/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 /Applications/MAMP/htdocs/GentseFeesten/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#2 /Applications/MAMP/htdocs/GentseFeesten/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#3 /Applications/MAMP/htdocs/GentseFeesten/public/index.php(27): Zend_Application->run()
#4 {main} Next exception 'Zend_Controller_Exception' with message 'Invalid controller specified (error)
#0 /Applications/MAMP/htdocs/GentseFeesten/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Re in /Applications/MAMP/htdocs/GentseFeesten/library/Zend/Controller/Plugin/Broker.php on line 336

It seems that you don't have access to the problem, because exceptions are catched by Zend_Controller_Plugin_ErrorHandler.
You have this exception because you have no ErrorController, and the handler is trying to call it.
You may have the exception details in your error logs.
In order to watch the error message., you can put this code in your bootstrap :
$front = Zend_Controller_Front::getInstance();
$front->throwExceptions( false );
or in the application.ini :
resources.frontController.throwexceptions = false
(very useful in developpement configuration)
However, if you use the errorHanlder, you should implement an ErrorController

Related

"Twig_Error_Loader Unable to find template", due to slashes added to template name

After upgrading macOS server, Twig seems to have broken. For some reason, the function normalizeName($name) in lib/Twig/Loader/Filesystem.php is breaking, and returning the template name with a slash before every character. For example, "index.html" becomes "/i/n/d/e/x/./h/t/m/l".
So when I try and use Twig's render() function that calls normalizeName(), I get the following error:
Fatal error: Uncaught exception 'Twig_Error_Loader' with message 'Unable to find template "/l/o/g/i/n/./h/t/m/l/" (looked into: /Library/Server/Web/Data/Sites/templates).'
Modifying normalizeName() so it simply returns what it was passed results in PHP terminating the script due to memory exhaustion (at about 125MB) in lib/Twig/Lexer.php on line 107.
The code with the problem is below.
require_once '/Library/Server/Web/Data/Sites/Twig/lib/Twig/autoloader.php';
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem('/Library/Server/Web/Data/Sites/templates/');
$twig = new Twig_Environment($loader, array(
'cache' => '/Library/Server/Web/Data/Sites/cache/',
'auto_reload' => 1
));
$twig -> render('login.html');
The full stack trace:
Fatal error: Uncaught exception 'Twig_Error_Loader' with message 'Unable to find template "/l/o/g/i/n/./h/t/m/l/" (looked into: /Library/Server/Web/Data/Sites/sccs_templates).' in /Library/Server/Web/Data/Sites/Twig/lib/Twig/Loader/Filesystem.php:247
Stack trace:
#0/Library/Server/Web/Data/Sites/Twig/lib/Twig/Loader/Filesystem.php(159): Twig_Loader_Filesystem->findTemplate('login.html')
#1 /Library/Server/Web/Data/Sites/Twig/lib/Twig/Environment.php(329): Twig_Loader_Filesystem->getCacheKey('login.html')
#2 /Library/Server/Web/Data/Sites/Twig/lib/Twig/Environment.php(418): Twig_Environment->getTemplateClass('login.html', NULL)
#3 /Library/Server/Web/Data/Sites/Twig/lib/Twig/Environment.php(362): Twig_Environment->loadTemplate('login.html')
#4 /Library/Server/Web/Data/Sites/sccs_includes/setup.php(252): Twig_Environment->render('login.html', Array)
#5 /Library/Server/Web/Data/Sites/Default/sccs/index.php(3): require_once('/Library/Server...')
#6 {main} thrown in /Library/Server/Web/Data/Sites/Twig/lib/Twig/Loader/Filesystem.php on line 247
I'm running Yosemite with Apache 2.4.23 and PHP 5.5.36, Twig 1.28.2.
Many thanks for any help!

Missing Controller Exception after installing FriendsOfCake/cakephp-csvview

I installed FriendsOfCake/cakephp-csvview using
php ../composer.phar require friendsofcake/cakephp-csvview:~3.0.
After which all pages show Missing Controller Exception (they were definitely OK), even after commenting out Plugin::load('CsvView') in bootstrap.php. I doubt php was unable to locate the controller class but don't know why. I have used find . -mtime -1, no files under src have changed.
Could anyone please tell me how Cakephp figures out the class file locations so I can troubleshoot?
Stack trace below:
2016-10-04 03:20:39 Warning: Headers already sent in {base}/vendor/cakephp/cakephp/src/Error/Debugger.php:753
2016-10-04 03:20:39 Error: [Cake\Routing\Exception\MissingControllerException] Controller class Holders could not be found.
Exception Attributes: array (
'class' => 'Holders',
'plugin' => false,
'prefix' => false,
'_ext' => false,
)
Request URL: /
Client IP: 127.0.0.1
Stack Trace:
#0 {base}/vendor/cakephp/cakephp/src/Http/ControllerFactory.php(72): Cake\Http\ControllerFactory->missingController(Object(Cake\Network\Request))
#1 {base}/vendor/cakephp/cakephp/src/Routing/Filter/ControllerFactoryFilter.php(63): Cake\Http\ControllerFactory->create(Object(Cake\Network\Request), Object(Cake\Network\Response))
#2 {base}/vendor/cakephp/cakephp/src/Routing/Filter/ControllerFactoryFilter.php(49): Cake\Routing\Filter\ControllerFactoryFilter->_getController(Object(Cake\Network\Request), Object(Cake\Network\Response))
#3 {base}/vendor/cakephp/cakephp/src/Routing/DispatcherFilter.php(144): Cake\Routing\Filter\ControllerFactoryFilter->beforeDispatch(Object(Cake\Event\Event))
#4 {base}/vendor/cakephp/cakephp/src/Event/EventManager.php(426): Cake\Routing\DispatcherFilter->handle(Object(Cake\Event\Event), Object(Cake\Network\Request), Object(Cake\Network\Response))
#5 {base}/vendor/cakephp/cakephp/src/Event/EventManager.php(391): Cake\Event\EventManager->_callListener(Array, Object(Cake\Event\Event))
#6 {base}/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(78): Cake\Event\EventManager->dispatch(Object(Cake\Event\Event))
#7 {base}/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(81): Cake\Http\ActionDispatcher->dispatchEvent('Dispatcher.befo...', Array)
#8 {base}/vendor/cakephp/cakephp/src/Routing/Dispatcher.php(60): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#9 {base}/webroot/index.php(37): Cake\Routing\Dispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#10 {main}
If at all, CakePHP only tries to figure fully qualified classnames from shorter ones, it doesn't handle including class files or figuring their locations, as of CakePHP 3 it relies on the composer autoloader (vendor/autoload.php) to do that.
If things broke after updating a dependency, which will also cause the autoloader to be re-dumped, chances are good that the autoloader broke (for whatever reason).

Uncaught exception 'Zend_Acl_Exception' with message 'Resource not found'

I am new to Zend Framework and I am trying to build a small website using it. So to build CMS I found one source code that is on Apress website of author Forrest Lyman. I also got the book from local market.
I wanted to have admin module separately so I have created admin module but I got problem in that I am not able to access controller other than IndexController. When I try to access other controller in admin module I am getting this error:
Fatal error: Uncaught exception 'Zend_Acl_Exception' with message 'Resource 'category' not found' in C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Acl.php:365 Stack trace: #0 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Acl.php(846): Zend_Acl->get('category') #1 C:\Server\Zend\Apache2\htdocs\cms\library\CMS\Controller\Plugin\Acl.php(52): Zend_Acl->isAllowed('administrator', 'category', 'index') #2 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Plugin\Broker.php(309): CMS_Controller_Plugin_Acl->preDispatch(Object(Zend_Controller_Request_Http)) #3 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Front.php(941): Zend_Controller_Plugin_Broker->preDispatch(Object(Zend_Controller_Request_Http)) #4 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch() #5 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #6 in C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Plugin\Broker.php on line 312
I found the solution..
After making a controller, I have to add resources in Acl.php file which is located in (library/CMS/Controller/Plugin/).
Just add this in add resources section
$acl->add(new Zend_Acl_Resource('category'));
Then you can access it.
Thanks.

Zend Framework Create Custom View Helper?

I have tried multiple fixes but none have worked. I am getting this error:
Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception'
with message 'Plugin by name 'AddCss' was not found in the registry;
used paths: Zend_View_Helper_:
Zend/View/Helper/:/Users/cgunnels/dev/git/rove-git/application/views/helpers/'
in
/usr/local/zend/share/ZendFramework/library/Zend/Loader/PluginLoader.php:412
Stack trace: #0
/usr/local/zend/share/ZendFramework/library/Zend/View/Abstract.php(1182):
Zend_Loader_PluginLoader->load('AddCss') #1
/usr/local/zend/share/ZendFramework/library/Zend/View/Abstract.php(618):
Zend_View_Abstract->_getPlugin('helper', 'addCss') #2
/usr/local/zend/share/ZendFramework/library/Zend/View/Abstract.php(344):
Zend_View_Abstract->getHelper('addCss') #3
/Users/cgunnels/dev/git/rove-git/application/layouts/scripts/layout.phtml(6):
Zend_View_Abstract->__call('addCss', Array) #4
/Users/cgunnels/dev/git/rove-git/application/layouts/scripts/layout.phtml(6):
Zend_View->addCss(Array) #5
/usr/local/zend/share/ZendFramework/library/Zend/View.php(108):
include('/Users/cgunnels...') #6 /usr in
/usr/local/zend/share/ZendFramework/library/Zend/Controller/Plugin/Broker.php
on line 336
this is my class:
class Zend_View_Helper_Css extends Zend_View_Helper_Abstract {
public function css() {
die("test");
}
}
I followed the instructions on this page http://framework.zend.com/manual/en/zend.view.helpers.html and it doesn't work.
I also added this to my application.ini:
resources.view.helperPath = APPLICATION_PATH "/views/helpers"
Please help me out, thanks
answer provided by author:
I fixed it. So the filename was CssHelper.php I changed it to Css.php
and it worked. – chris gunnels

exception 'Zend_Controller_Action_Exception' with message 'Action "index" does not exist and was not trapped in __call()?

Anyone know what this error means? after googling I found a bunch of sites that appear to have the same error? thanks
exception 'Zend_Controller_Action_Exception' with message 'Action "index" does not exist and was not trapped in __call()' in /usr/local/zend/apache2/htdocs/pintsy/lib/Zend/Controller/Action.php:485
Stack trace:
#0 /usr/local/zend/apache2/htdocs/pintsy/lib/Zend/Controller/Action.php(515): Zend_Controller_Action->__call('indexAction', Array)
#1 /usr/local/zend/apache2/htdocs/pintsy/lib/Zend/Controller/Dispatcher/Standard.php(289): Zend_Controller_Action->dispatch('indexAction')
#2 /usr/local/zend/apache2/htdocs/pintsy/lib/Zend/Controller/Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#3 /usr/local/zend/apache2/htdocs/pintsy/html/index.php(114): Zend_Controller_Front->dispatch()
#4 {main}
It means there's no indexAction method in your controller class.
Your controller was instantiated and, based on the URL, Magento determined the action was "index". This is the default action. For example, if you have a URL like this
http://example.com/products/
is usually (Zend is used differently all over the place) the same as a URL like this
http://example.com/products/index
That is, they would both instantiate a ProductController and with an action of index.
public function indexAction(){...}
So, your controller is missing a method named indexAction. What happens next is, the request is sent to PHP magic __call method. If this method exists on a class, calls to non-existent methods go there. The Zend Exception is telling you that, in addition to there being no method for indexAction, there was nothing in __call about indexAction either.
If you got the same error in apache log means, it might be because of invalid path for the css or javascript or image files

Categories