#45704 [Com]: $exception->getCode() always return 0x80020009 even when it shouldn't

From: Date: Fri, 16 Oct 2009 09:01:16 +0000
Subject: #45704 [Com]: $exception->getCode() always return 0x80020009 even when it shouldn't
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-143625@lists.php.net to get a copy of this message
ID: 45704 Comment by: andrey dot klimovskiy at f-secure dot com Reported By: tceverling at yahoo dot co dot uk Status: Open Bug Type: COM related Operating System: Windows XP SP2 PHP Version: 5.2.6 New Comment: I would like to catch and process custom COM exceptions at PHP, but $exception->getCode() always return 0x80020009. The same situation for standart HRESULT values. Previous Comments: ------------------------------------------------------------------------ [2009-02-16 09:27:13] tceverling at yahoo dot co dot uk This bug is still present in "Apache/2.2.10 (Win32) PHP/5.2.8", Windows XP SP3. We are still unable to use the codes provided by the thrown exceptions to provide alternative paths or give meaningful messages either to the user or to an error log. ------------------------------------------------------------------------ [2008-08-04 07:30:18] tceverling at yahoo dot co dot uk Description: ------------ When a COM object throws an exception, the getCode() always return 0x80020009 even when it should be some other value. This is reproducible with "Scripting.FileSystemObject", "Scripting.Dictionary" and "Autodesk.MgSdfToolkit". Reproduce code: --------------- echo 'For "Scripting.FileSystemObject".'; try { $fso = new COM("Scripting.FileSystemObject"); $f = $fso->GetFile("c:\\does not exist.txt"); } catch (Exception $e) { //print_r($e); echo dechex($e->getCode()); } echo 'For "Scripting.Dictionary".'; try { $d = new COM("Scripting.Dictionary"); $d->Remove("b"); } catch (Exception $e) { //print_r($e); echo dechex($e->getCode()); } Expected result: ---------------- For 'Scripting.FileSystemObject': 800A0035 For 'Scripting.Dictionary': 800A802B Actual result: -------------- For 'Scripting.FileSystemObject': 80020009 For 'Scripting.Dictionary': 80020009 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45704&edit=1

« previous php.bugs (#143625) next »