Ok, the details of the problem obviously aren't being understood.
Let's assume that I explained it poorly and I'll try again. Take the
following code (It's complete, cut/paste to see what happens.):
<?php
class running {
private $running;
public function __construct() {
$this->running = true;
}
public function stop() {
$this->running = false;
}
public function __destruct() {
if ($this->running) {
throw new exception('I have not stopped running yet!');
}
}
}
function fail_horribly() {
throw new exception('This is the real error that I want a stack trace from');
}
function do_that_thing() {
$running = new running();
fail_horribly();
$running->stop();
}
try {
do_that_thing();
}
catch (exception $e) {
echo $e->getMessage();
}
?>
While putting this together, I discovered lots of interesting
behaviour. Depending on exactly where I put the try/catch, there are
different things that happen and different errors that occur. It's
kinda interesting.
The thing is, that none of those errors is the result that I _want_
which is to ignore the fact that $running was unset and just report
the error that started everything going wrong.
If I could put my fictional function (get_current_exception()) in the
__destruct() method, I could detect that an exception was already in
progress and avoid throwing another one.
--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php