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

  • SEARCH
  • Home
  • 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 1013021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:02:02+00:00 2026-05-16T10:02:02+00:00

I have an Acl plug-in which extends Zend_Controller_Plugin_Abstract , this plug-in handles all my

  • 0

I have an Acl plug-in which extends Zend_Controller_Plugin_Abstract, this plug-in handles all my Acl code.

I want to thrown an Exception in this plug-in, e.g. an Exception_Unauthorised and then handle this in my ErrorController, this way I can use the same Acl plug-in for different applications and use the ErrorController to handle each situation in each application differently – if need be.

The problem is that throwing an Exception in the plug-in does not stop the original Action from executing. So I end up with the original Action’s output and the ErrorController output.

How can I get an Exception thrown in a plug-in to stop the original Action from taking place?

Case 1

// This throws the `Exception_NoPermissions`, but it does not get caught by
// `ErrorController`
public function preDispatch(Zend_Controller_Request_Abstract $request)
{       
    parent::preDispatch($request);
    throw new Exception_NoPermissions("incorrect permissions");
}

Case 2

// This behaves as expected and allows me to catch my Exception
public function preDispatch(Zend_Controller_Request_Abstract $request)
{       
    parent::preDispatch($request);
    try
    {
        throw new Exception_NoPermissions("incorrect permissions");
    }
    catch(Exception_NoPermissions $e)
    {

    }
}

Case 3

I think this is where the issue is, by changing the controller.

public function preDispatch(Zend_Controller_Request_Abstract $request)
{       
    parent::preDispatch($request);

    // Attempt to log in the user

    // Check user against ACL

    if(!$loggedIn || !$access)
    {
        // set controller to login, doing this displays the ErrorController output and
        // the login controller
        $request->getControllerName("login");
    }
}
  • 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-16T10:02:02+00:00Added an answer on May 16, 2026 at 10:02 am

    I had a quick chat about this on the #zftalk IRC channel, and Ryan Mauger / Bittarman said that currently you would need to manually redirect the user if the exception happens in a plugin.

    I also had an idea that maybe you could use a separate plugin to check for an exception. If you look at the ErrorHandler plugin, it checks if the request contains an exception and acts on it.

    The problem is that the ErrorHandler fires on routeShutdown, eg. when the request has already finished. If you created a custom plugin which looks at the exception, but runs on preDispatch, it might be possible to automate this task.

    Note that you would need to make sure this custom plugin is ran after any plugins that may throw exceptions.

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

Sidebar

Related Questions

I have this code. The method returns a (User, Acl, Tree) tuple. Instead of
i want to build an ACL system for my application which have the following
have written this little class, which generates a UUID every time an object of
I'm implementing a file system. Folders each have an ACL, which will basically just
I have this security.yml file. I want to know do i need two firewalls
I have a C# code which creates a folder and sets some permissions on
I have an issue updating the Acl for a Google Document. I want to
I want to allow resource to role using ACL in Zend framework I have
i have wrote an agent which works like this- whenever my subordinates get any
I have just installed the ACL and Content Access module. Imedietly after enabling them

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.