From:             csaba at alum dot mit dot edu
Operating system: Win XP Pro
PHP version:      5.2.5
PHP Bug Type:     Class/Object related
Bug description:  get_class problem with COM objects

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

-- 
Edit bug report at http://bugs.php.net/?id=43275&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43275&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43275&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43275&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43275&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43275&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43275&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43275&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43275&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43275&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43275&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43275&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43275&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43275&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43275&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43275&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43275&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43275&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43275&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43275&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43275&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43275&r=mysqlcfg

Reply via email to