Bug #36588 [Com]: COM can't handle out parameter in function call

From: Date: Wed, 16 Apr 2014 18:29:16 +0000
Subject: Bug #36588 [Com]: COM can't handle out parameter in function call
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185293@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=36588&edit=1 ID: 36588 Comment by: mike dot weiss at clear-river dot com Reported by: e dot vandeoudeweetering at marcanti dot esprit-sg dot Summary: COM can't handle out parameter in function call Status: Not a bug Type: Bug Package: COM related Operating System: Windows 2000 (5.00.2195) SP4 PHP Version: 5.1.2 Block user comment: N Private report: N New Comment: I disagree with the other comment. According to: http://www.php.net/manual/en/class.com.php "Starting with PHP 5, PHP will automatically detect methods that accept parameters by reference, and will automatically convert regular PHP variables to a form that can be passed by reference. This means that you can call the method very naturally; you needn't go to any extra effort in your code." Previous Comments: ------------------------------------------------------------------------ [2006-03-06 09:21:45] e dot vandeoudeweetering at marcanti dot esprit-sg dot Sorry! Regards Edwin. ------------------------------------------------------------------------ [2006-03-06 09:21:00] e dot vandeoudeweetering at marcanti dot esprit-sg dot Please mark this request as BOGUS! Wrap the variable into a variant object, then make the function call: $com_reg = new COM("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\default:StdR egProv"); $value = new VARIANT(); $com_reg -> getStringValue('subtree', "key\\subkey", 'entryName', $value); print $value; see: http://bugs.php.net/bug.php?id=16567 http://www.php.net/variant ------------------------------------------------------------------------ [2006-03-02 11:44:46] e dot vandeoudeweetering at marcanti dot esprit-sg dot Description: ------------ When COM is used to retrieve an out parameters value in a function call, the value remains empty. See: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/getstringvalue_method_in_class_stdregprov.asp Reproduce code: --------------- $com_reg = new COM("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\default:StdRegProv"); $value = 'old_value'; $com_reg -> getStringValue('subtree', "key\\subkey", 'entryName', $value); print $value; Expected result: ---------------- The value from the registry key 'subtree\key\subkey\entryName' should be printed. Actual result: -------------- The value 'old_value' that is declared earlier in the code is printed. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=36588&edit=1

« previous php.bugs (#185293) next »