php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7116 Passing values By Reference into a VB DLL
Submitted: 2000-10-10 07:20 UTC Modified: 2001-01-29 17:10 UTC
From: rob at regemc dot fsnet dot co dot uk Assigned:
Status: Closed Package: COM related
PHP Version: 4.0.2 OS: Windows 2000 Server
Private report: No CVE-ID: None
 [2000-10-10 07:20 UTC] rob at regemc dot fsnet dot co dot uk
A function exists in my Visual Basic 6 DLL.

This function supports ByRef (by reference) parameters.  This enables me to modify the parameters that are coming in.

When I try to do a standard call on my function from PHP, the function works but my variables do not come back modified like they should do.

Therefore, I tried calling the function from PHP by prefixing the parameter argument with a "&".  This worked fine, bringing back my modified parameters.  However, I got warnings from the PHP compiler to the effect of...

***************************************************
Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. 
***************************************************

The warning stated that my argument had been passed "By Value", even though it worked.

To summarize...

a) I cannot pass an argument By Reference to a VB DLL and make it work unless I prefix the argument with an "&" in the PHP call.

b) The warning states that the message was passed By Value, when in fact it WAS passed By Reference because my function changed the value of the variable.

It seems that you either need to keep the call-time "By Refence" passing in operation, or correct the "By Reference" passing when the COM object has declared the argument of the function to be "ByRef".

If you have any further questions, please contact me.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-29 17:08 UTC] phanto@php.net
this is fixed in cvs now.

short example:
--------------------

$foo = new COM("object");
$bar = new VARIANT(); // or VARINAT($var);
                      // or VARINAT("blah", "VT_BSTR");

$foo->function($bar);

echo $bar->value;
 [2001-01-29 17:10 UTC] phanto@php.net
this is fixed in cvs now.

short example:
--------------------

$foo = new COM("object");
$bar = new VARIANT(); // or VARINAT($var);
                      // or VARINAT("blah", "VT_BSTR");

$foo->function($bar);

echo $bar->value;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC