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 8881397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:20:23+00:00 2026-06-14T20:20:23+00:00

I have the security component in one of my comment submit forms.. Now, when

  • 0

I have the security component in one of my comment submit forms..
Now, when something goes wrong, and the blackhole callback is called, I want to throw an InternalErrorException with a custom message, such as:

 throw new InternalErrorException('You have tried to submit a comment whose security token is either invalid or expired. Please try again by reloading the blog post and commenting again. Thank you.');

The thing is that the message does not get displayed in production mode (debug == 0). What do I have to do to show the message to the user instead of “An Internal Error Has Occurred”?

This is my error500.ctp: http://pastebin.com/t9NuzuqS

  • 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-06-14T20:20:25+00:00Added an answer on June 14, 2026 at 8:20 pm

    What you can probably do is overwrite the blackHole action of the Security component.

    Currently you can find it in cakephp\lib\Cake\Controller\Component\SecurityComponent. You should create a SecurityComponent in your Controller\Component folder and overwrite this method as you wish:

    public function blackHole(Controller $controller, $error = '') {
        if ($this->blackHoleCallback == null) {
            throw new BadRequestException(__d('cake_dev', 'The request has been black-holed'));
        } else {
            return $this->_callback($controller, $this->blackHoleCallback, array($error));
        }
    }
    

    You can throw the same exception with another message.
    This exceptions will be seen for users even with debug set to 0 as detailed on the documentation

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

Sidebar

Related Questions

In my project,I have integrated Spring Security with CAS server authentication. Now my project
I have written a simple upload component in Flash, but I am now having
I am trying to use Symfony 2 security component, but I have a problem
I have java program which receives encrypted message through TCP/IP from one component of
I have a security problem. I think to lock a table would be a
I have a security function which is part of a script. It's supposed to
I have a security consultant demanding that we implement encrypted connections to mySQL. He
I have some security related service running on my machine (start type = automatic)
I have a security number generator device, small enough to go on a key-ring,
Is there a way to see users that have certain security role assigned? I'm

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.