#34463 [NEW]: eval/new COM => hang on com_print_typeinfo

From: Date: Sun, 11 Sep 2005 12:40:53 +0000
Subject: #34463 [NEW]: eval/new COM => hang on com_print_typeinfo
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-84863@lists.php.net to get a copy of this message
From: csaba at alum dot mit dot edu Operating system: PHP version: 5CVS-2005-09-11 (snap) PHP Bug Type: Scripting Engine problem Bug description: eval/new COM => hang on com_print_typeinfo Description: ------------ If I do eval('$com=new COM("WScript.Shell");'); then gettype($com) is the empty string while com_print_typeinfo($com) leads to the CLI / Apache error dialog box asking whether I want to send Microsoft a report about it. Nevertheless, the $com object is (at least somewhat) valid because I can subsequently (if I didn't do a com_print_typeinfo) do other things with it. Thus, gettype is incorrect, and com_print_typeinfo should not crash PHP. Csaba Gabor from Vienna PS. Uncomment any of the 3 new COM lines, and it runs as expected. Marked as a Scripting Engine Problem since the problem seems to start in the eval line. Reproduce code: --------------- <?php print "<pre>\n"; $oEnv = newCOM("WScript.Shell")->Environment("process"); foreach ($oEnv as $idx=>$val) print "$idx: $val\n"; print "</pre>"; function newCOM($comSpec) { $eval = '$newCom = new COM("' . $comSpec . '");'; print ("going to eval: $eval\n"); try { eval($eval); } catch (Exception $e) { output("Could not load COM: $comSpec"); return null; } //$newCOM = new COM("WScript.Shell"); //$newCOM = new COM(&$comSpec); //$newCOM = new COM($comSpec); print "newCOM has gettype: " . gettype($newCOM) . "\n"; print " typename: " . typename($newCOM) . "\n\n"; com_print_typeinfo($newCOM); return $newCom; } function typename($objCOM) { if (is_null($objCOM)) return null; $oScript = new COM("MSScriptControl.ScriptControl"); $oScript->language = "VBScript"; $oScript->addObject("objCom",$objCOM); return $oScript->eval("typename(objCom)"); } ?> Expected result: ---------------- After the 'going to eval' line, I expect to see: newCOM has gettype: object typename: IWshShell3 Actual result: -------------- newCOM has gettype: NULL typename: followed by a PHP crash If you remove the com_print_typeinfo line, the rest of the code executes as expected. In other words, the COM object functions so the gettype is still wrong. -- Edit bug report at http://bugs.php.net/?id=34463&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34463&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34463&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34463&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34463&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34463&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34463&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34463&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34463&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34463&r=support Expected behavior: http://bugs.php.net/fix.php?id=34463&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34463&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34463&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34463&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34463&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34463&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34463&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34463&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34463&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34463&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34463&r=mysqlcfg

« previous php.bugs (#84863) next »