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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:06:19+00:00 2026-05-23T11:06:19+00:00

A login function writes a couple of session variables after successful authentication and then

  • 0

A login function writes a couple of session variables after successful authentication and then redirects to itself to print a welcome message (the view changes based on authentication status). This works fine with debug >= 0.
Now, when I add a CakeLog::write() to that same login function, it stops working with debug = 0 and an empty page is displayed. It continues working with debug > 0.

According to the Apache logs, the white page is the result of an error 500 following a POST request.

What does CakeLog::write() do apart from writing to a log file?

‘Session’, ‘Security’ and ‘Auth’ components are involved, but I do not call the requirePost method.

CakeLog::write() returns true if successful but catching the return code doesn’t change the issue that further code execution is interrupted. I have to reload the white page in order to continue (i.e. replace the POST with a GET request).

Here is the users_controller’s login:

function login(){
 [if form contains data do some LDAP checking...]
  if($permission>0){
   $this->Session->write('logname', $samaccountname);
   $this->Session->write('logperm', $permission);
   [...]

   // Here is where it blocks. Without this line debug=0 is okay
   $result = CakeLog::write('log', $samaccountname);

   $this->Auth->login();
   // the Auth redirect target is set in the app_controller to allow jumping right 
   // to the originally intended URL, usually it redirects to itself
   $this->redirect($this->Auth->redirect());
   }
  }

And this is the app_controller’s beforeFilter:

function beforeFilter(){
 $this->Security->blackHoleCallback = 'showErrorPage';
 $this->Security->requireAuth();
 $this->Security->requireSecure();

 if($this->Session->read('logperm') < 1 && $this->here != '/users/login'){
  $this->Auth->redirect($this->here); // store chosen URL
  $this->redirect('/users/login');
  }
 if($this->Session->read('logperm') == 3)
  $this->Auth->allow('*');
 elseif[...]
 }
  • 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-23T11:06:20+00:00Added an answer on May 23, 2026 at 11:06 am

    Thanks @François, that pointed me into the right direction.
    It was necessary to set

    Configure::write('log', true);
    

    to ensure that message and error logging works even if debug=0 (added this in bootstrap).
    By the way the 1.3 cookbook exlicitely states that logging is enabled by default even if debug=0. That might be a glitch in the documentation.

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

Sidebar

Related Questions

I'm using login function in my site with session. This session of mine gets
I am trying to write a login script. After logging in a session variable
This is the login function (after I validate user name and password, I load
I am testing my login function at my server (auto ip ban after x
Controller function login() { // Don't show the error message if no data has
I am new to php and trying to write a login function. Bit stuck
Can anyone see anything wrong with this login script: public function login($username, $pass, $remember)
I have this jQuery: $(document).ready(function() { $(#panel).hide(); $('.login').toggle( function() { $('#panel').animate({ height: 150, padding:20px
why won't this work? function login(){ if(window.XMLHttpRequest){ ajax=new XMLHttpRequest(); }else if(window.ActiveXObject){ ajax=new ActiveXObject(Microsoft.XMLHTTP); }
I got this from for a login form tutorial: function sanitize($securitystring) { $securitystring =

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.