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?

[EMAIL PROTECTED] ~ $ cat testerror.php
<?

ini_set('session.save_path', '/var/log');

try {
    set_error_handler('save_handler', E_ALL);
    session_start();
    restore_error_handler();
} catch (Exception $e) {
    echo $e->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);
}
[EMAIL PROTECTED] ~ $ 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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to