php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51904 Can't get message from com_exception
Submitted: 2010-05-25 08:29 UTC Modified: 2020-01-27 17:36 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: spyfox dot home at gmail dot com Assigned:
Status: Open Package: COM related
PHP Version: 5.3.2 OS: Windows XP SP3
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-05-25 08:29 UTC] spyfox dot home at gmail dot com
Description:
------------
I have simple script with using COM object "Scripting.FileSystemObject" that usually used in JScript (VBscript).
It's work fine, but when I try to catch error (Folder doesn't exist) I can't get error message :(

-----------------------------
Sorry for my bad english :)

Test script:
---------------
<?
    try
    {
        $FS = new COM('Scripting.FileSystemObject');
        $fold = $FS->GetFolder('f:/bash');
        $folds = $fold->SubFolders();
        foreach($folds as $sf)
            echo $sf->name . '<br>';
    }
    catch(com_exception $e)
    {
        echo 'Error msg: ', $e->getMessage();
    }
?>

Expected result:
----------------
Error msg: Path not found

Actual result:
--------------
Error msg: Source: Unknown Description: Unknown

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-15 15:44 UTC] felipe@php.net
-Summary: Can't get mesaage from com_exception +Summary: Can't get message from com_exception
 [2020-01-27 17:36 UTC] cmb@php.net
I can confirm the reported behavior (PHP-7.4).

The problem is that the calling IDispatch_Invoke()[1] does neither
populate the bstrSource nor the bstrDescription member of the
EXCEPINFO.  Still, the scode member holds 0x800A004C
(CTL_E_PATHNOTFOUND), which may be used to retrieve a more useful
error message.

[1] <https://github.com/php/php-src/blob/php-7.4.2/ext/com_dotnet/com_com.c#L351>
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Oct 25 17:01:24 2020 UTC