php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41253 session_start Warnings caught by error handler produce E_Fatal
Submitted: 2007-05-01 16:17 UTC Modified: 2007-05-02 10:49 UTC
From: ralph at smashlabs dot com Assigned:
Status: Not a bug Package: Session related
PHP Version: 5.2.1 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ralph at smashlabs dot com
New email:
PHP Version: OS:

 

 [2007-05-01 16:17 UTC] ralph at smashlabs dot com
Description:
------------
Abstract: when handling php errors via set_error_handler() with the intention of throwing a catchable error, an E_FATAL error is triggered.

Details: This is similar to the error you might see when attempting to throw an exception from an objects destructor.  The internal pointer to the unwinding stack is lost and/or blown away.

without the error handler session_start with an invalid save_path will produce an E_WARNING

Reproduce code:
---------------
<?

ini_set('session.save_path', '/var/log'); 
set_error_handler('save_handler', E_ALL); 
try { 
    session_start(); 
} catch (Exception $e) { 
    echo $e->getMessage(); 
} 

function save_handler($errno, $errmsg) 
{ 
    throw new Exception('Error caught and thrown as exception: ' . $errmsg); 
}  


Expected result:
----------------
Error caught and thrown as exception: session_start(): open(/var/log/sess_3e97dad0fe4ce6f285e97593471f2c88, O_RDWR) failed: Permission denied (13)

Actual result:
--------------
Error caught and thrown as exception: session_start(): open(/var/log/sess_3e97dad0fe4ce6f285e97593471f2c88, O_RDWR) failed: Permission denied (13)
Fatal error: Exception thrown without a stack frame in Unknown on line 0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-02 10:49 UTC] tony2001@php.net
I don't see anything wrong here.
You're trying to throw an exception when the engine is shutting down, so you get a pretty much expected fatal error.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jun 16 03:01:35 2025 UTC