php.net |  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
Votes:3
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] yohgaki@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: yohgaki
 [2013-07-31 02:09 UTC] yohgaki@php.net
It seems fixed at least in 5.5.1.

Windows7 x86.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 00:01:41 2024 UTC