Bug #52890 [NEW]: Exception not caught sometimes

From: Date: Mon, 20 Sep 2010 05:28:48 +0000
Subject: Bug #52890 [NEW]: Exception not caught sometimes
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-154498@lists.php.net to get a copy of this message
From:             
Operating system: Linux
PHP version:      5.3.3
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Exception not caught sometimes

Description:
------------
An Exception thrown is not caught by the corresponding catch block, instead
the global exception handler is invoked. That only happens on one page
during a long selenium test case. The bug is reproduceable with the
selenium test script, but stripping the code to a small example does not
result in an error. Will will add the stripped version of the code which
does not fail, but show the code.

The System is a 64bit Zend Server 5.3 CE on CentOS 5.5. The same code on a
Zend Server 5.2 CE does not have this problem. The problem also occurred in
PHP 5.3.2


In the example script $defer should be set to true but instead of catching
the excepetion in that block the global exception handler is called.

A fix for this is currently to use bofre the throw:
if (version_compare(PHP_VERSION, '5.3.0', '>=') &&
version_compare(PHP_VERSION, '5.3.3', '<=')) {
   set_exception_handler(create_function('$exception', 'return $exception
instanceof iwat_ui_controller_ObjectSaveDeferredException ? true :
userExceptionHandler($exception);'));
}
as the application behaves as expected, but that bug still exists.
Disabling all Zend modules has no effect

Test script:
---------------
try {
    doSave();
} catch (iwat_ui_controller_ObjectSaveDeferredException $e) {
    $defer = true;
} catch (IWATException $e) {
}

function doSave() {
    throw new iwat_ui_controller_ObjectSaveDeferredException();
}


-- 
Edit bug report at http://bugs.php.net/bug.php?id=52890&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=52890&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=52890&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=52890&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=52890&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52890&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=52890&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=52890&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=52890&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=52890&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=52890&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=52890&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=52890&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=52890&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=52890&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52890&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52890&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=52890&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=52890&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=52890&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=52890&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=52890&r=mysqlcfg



Thread (8 messages)

« previous php.bugs (#154498) next »