Bug #51904 [Opn]: Can't get message from com_exception

From: Date: Mon, 27 Jan 2020 17:36:07 +0000
Subject: Bug #51904 [Opn]: Can't get message from com_exception
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225159@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=51904&edit=1 ID: 51904 Updated by: cmb@php.net Reported by: spyfox dot home at gmail dot com Summary: Can't get message from com_exception Status: Open Type: Bug Package: COM related Operating System: Windows XP SP3 PHP Version: 5.3.2 Block user comment: N Private report: N New Comment: 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> Previous Comments: ------------------------------------------------------------------------ [2010-05-25 08:29:43] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=51904&edit=1

« previous php.bugs (#225159) next »