Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1103135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:17:46+00:00 2026-05-17T01:17:46+00:00

As mentioned in the Zend Framework manual , I created a base controller. Subclassing

  • 0

As mentioned in the Zend Framework manual, I created a base controller.

Subclassing the Action Controller

By design, Zend_Controller_Action must
be subclassed in order to create an
action controller. At the minimum, you
will need to define action methods
that the controller may call.

Besides creating useful functionality
for your web applications, you may
also find that you’re repeating much
of the same setup or utility methods
in your various controllers; if so,
creating a common base controller
class that extends
Zend_Controller_Action could solve
such redundancy.

But it turns out, that Exceptions are not being called properly from the base… To replicate this, create a file:

/path/to/workspace/library/Joe/Controller.php

Then:

class Joe_Controller extends Zend_Controller_Action
{
    public function init()
    {
        Throw new Zend_Exception('test', 500);
        parent::init();
    }
}

Then in your controller directory, IndexController.php extends off the base:

class IndexController extends Joe_Controller
{

You will find that the exception is uncaught.

If however, you don’t extend off the base controller, then throw an exception in init or preDispatch, it will be caught and forwarded to the ErrorController.

Anyone have an idea on getting the exceptions caught from the Base Controller?

Thanks.

UPDATING TO TACKLE THIS ANOTHER WAY

After looking at the various articles and official documentation on how to structure the directories, I went with putting the base controller in library/Joe/…but maybe that’s part of the problem…there’s no guidance in the manual on how to name and place the base controller. What do the experts with a base controller do?

Another Update

Looking at my code some more, and reading on the net, seems like people suggested in should be:

abstract class Joe_Controller_Action extends Zend_Controller_Action.

Except changing it did not solve the problem…

Now considering that there are articles suggesting to use Base Controllers including the manual, would this be considered a bug in Zend Framework?

To replicate, just throw a Zend_Exception of any kind in the base init or preDispatch. Imagine you poll the database in there, (which is what I’m doing)…and the database is down. No error controller. That’s not a good situation unless I’m doing something incorrectly.

My suspicion is that this is a new bug… I don’t recall this problem before Zend_Application and I’ve been using a base controller since ZF 1.5.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:17:47+00:00Added an answer on May 17, 2026 at 1:17 am

    Two thoughts off the top of my head:

    1. Controller names in the default module are usually named like SomethingController. Your name Joe_Controller suggests the module Joe and an empty controller name.

    2. In routing/dispatch, doesn’t it look for a matching action before dispatch to the controller? Since the samples have no actions, might you be triggering ControllerNotFound exception?

    Just throwin’ out some ideas.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the examples mentioned for Out-of-order writes for double-checked locking scenarios (ref: IBM article
I can't find any setImage method. Using Zend Framework 1.10.2 (1.10.3 was released today,
I am working with legacy code written in PHP 5.2.6 with Zend Framework 1.5.3
I've seen lots of videos and instructions on how to install zend framework on
I'm trying to connect to a Firebird database using the Zend Framework library (see
I'm currently building a web application using Zend framework 1.11.11 and Doctrine 2.2. I
I am developing a project on windows with wamp installed using zend framework. Unfortunately
I was going through some tutorial and documentation about zend framework, most of things
I am a newbie of Zend Framework. I downloaded the Zend Framework and then
Part 1 I want to build a PHP Zend Framework application that users can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.