Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29130 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74961 invoked by uid 1010); 2 May 2007 18:06:27 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 74936 invoked from network); 2 May 2007 18:06:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 May 2007 18:06:27 -0000 Authentication-Results: pb1.pair.com header.from=ralph@smashlabs.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ralph@smashlabs.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain smashlabs.com from 67.15.58.61 cause and error) X-PHP-List-Original-Sender: ralph@smashlabs.com X-Host-Fingerprint: 67.15.58.61 openrce.org Received: from [67.15.58.61] ([67.15.58.61:35558] helo=SMASHER.SMASHlabs.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 74/10-06175-613D8364 for ; Wed, 02 May 2007 14:06:15 -0400 Received: (qmail 6449 invoked from network); 2 May 2007 13:06:11 -0500 Received: from mail1.tippingpoint.com (HELO ?152.67.136.103?) (66.179.208.36) by smashlabs.com with (DHE-RSA-AES256-SHA encrypted) SMTP; 2 May 2007 13:06:11 -0500 Message-ID: <4638D2F4.8030706@smashlabs.com> Date: Wed, 02 May 2007 13:05:40 -0500 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666 MIME-Version: 1.0 To: internals Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Error handling in php with session_start From: ralph@smashlabs.com (Ralph Schindler) Instead of reopening a bug report, I figured I'll post it here to get better exposure. Myself (and a few others at Zend) feel like http://bugs.php.net/bug.php?id=41253 is most definitely a bug in the engine as it relates to ext/session. What is trying to be accomplished is the following: If a developer is utilizing a class that calls session_start(), and something goes wrong, I want to be able to gracefully alert the developer. This means I want to catch any warnings (like the warning you get when you try to open an unwritable session file), and throw them as exceptions, so far this shouldn't be and out of the ordinary request. Since ext/session gives no reliable way to retrieve session.save_path when its not explicitly set, the only way to handle it is via error_handlers. IMO, the engine is not suppose to shutdown the way it does in the following example. Is the the following totally unacceptable to think that this should not work as expected? webdeveloper@webdevelopment ~ $ cat testerror.php getMessage(); } echo 'I NEED THIS LINE TO BE RUN REGARDLESS, WITHOUT THROWING A FATAL'; function save_handler($errno, $errmsg) { throw new Exception('Error caught and thrown as exception: ' . $errmsg); } webdeveloper@webdevelopment ~ $ php testerror.php Error caught and thrown as exception: session_start(): open(/var/log/sess_ed8d2518c68c574daf21c42cae51448d, O_RDWR) failed: Permission denied (13)I NEED THIS LINE TO BE RUN REGARDLESS WITHOUT THROWING A FATAL Fatal error: Exception thrown without a stack frame in Unknown on line 0