|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45704 $exception->getCode() always return 0x80020009 even when it shouldn't
Submitted: 2008-08-04 07:30 UTC Modified: 2013-07-31 02:09 UTC
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: tceverling at yahoo dot co dot uk Assigned: yohgaki (profile)
Status: Closed Package: COM related
PHP Version: 5.2.6 OS: Windows XP SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: tceverling at yahoo dot co dot uk
New email:
PHP Version: OS:


 [2008-08-04 07:30 UTC] tceverling at yahoo dot co dot uk
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) {
    echo dechex($e->getCode());

echo 'For "Scripting.Dictionary".';
try {
    $d = new COM("Scripting.Dictionary");
catch (Exception $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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-16 09:27 UTC] 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.
 [2009-10-16 09:01 UTC] andrey dot klimovskiy at f-secure dot com
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.
 [2013-07-31 02:09 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: yohgaki
 [2013-07-31 02:09 UTC]
It seems fixed at least in 5.5.1.

Windows7 x86.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Oct 05 05:05:53 2022 UTC