From: msisolak at yahoo dot com Operating system: Windows 2000 Professional PHP version: 5.0.0 PHP Bug Type: COM related Bug description: com_method_get() appears to not handle non-existant method properly
Description: ------------ Trying to echo a COM object results in crash. When zend_call_function() is called to lookup "__tostring" in a COM object, it calls into com_method_get(). In turn this calls ITypeComp_Bind to lookup the method. If the method is not found the result is DESCKIND_NONE, but the switch(kind) statement isn't testing for this. As a result com_method_get() returns a zend_internal_function with an invalid handler. The handler is called and PHP crashes. I came up with this possible code as the response to a DESCKIND_NONE: case DESCKIND_NONE: ITypeComp_Release(comp); efree(olename); return NULL; but I'm not too confident about it. It does stop the crash in my test case, but there may be a better solution. Reproduce code: --------------- $c = new COM("ADODB.Connection"); echo $c; Expected result: ---------------- Either error on trying to echo object with no __toString() method, or nothing. Actual result: -------------- The instruction at "0x00e5c208" referenced memory at "0x0000000". The memory could not be "written". -- Edit bug report at http://bugs.php.net/?id=29392&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29392&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29392&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29392&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29392&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29392&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29392&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29392&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29392&r=support Expected behavior: http://bugs.php.net/fix.php?id=29392&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29392&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29392&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29392&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29392&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29392&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29392&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29392&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29392&r=float