|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-04-07 17:47 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
[2015-04-07 17:47 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 01:00:01 2025 UTC |
Description: ------------ Anomaly: get_class returns "com" with InternetExplorer and Excel COM objects. But with other COM objects it returns "variant". This seems inconsistent to me. Reproduce code: --------------- <?php $ie = new COM("InternetExplorer.Application"); $ie->Navigate2 ("about:blank"); while ($ie->readyState<4) { com_message_pump(200); } $doc = $ie->document; $body = $doc->body; $excel = new COM("Excel.Application"); $wb = $excel->workbooks->add(); $aCom = array(ie, doc, body, excel, wb); foreach ($aCom as $comObj) print "$comObj: " . gettype($$comObj) . " => " . get_class($$comObj) . "\n"; ?> Expected result: ---------------- ie: com => IWebBrowser2 doc: com => HTMLDocument body: com => HTMLBody excel: com => Application wb: com => Workbook or ie: object => com:IWebBrowser2 doc: object => com:HTMLDocument body: object => com:HTMLBody excel: object => com:Application wb: object => com:Workbook or at a bare minimum ie: object => com doc: object => com body: object => com excel: object => com wb: object => com To be specific: I am advocating that gettype() on a com object return "com". More importantly, get_class on a COM object should return consistently: either always "com", or "com:" followed by the typename, or (my preference) simply the typename. Typename here refers to the VB typename function (or use my typeName function found on http://php.net/com_print_typeinfo) Csaba Gabor from Vienna Actual result: -------------- ie: object => com doc: object => variant body: object => variant excel: object => com wb: object => variant