PHP 4.0 Bug #7116: Passing values By Reference into a VB DLL
| From: | rob at regemc dot fsnet dot co dot uk | Date: | Tue, 10 Oct 2000 11:20:16 +0000 |
| Subject: | PHP 4.0 Bug #7116: Passing values By Reference into a VB DLL | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-34571@lists.php.net to get a copy of this message | ||
From: rob@regemc.fsnet.co.uk
Operating system: Windows 2000 Server
PHP version: 4.0.2
PHP Bug Type: COM related
Bug description: Passing values By Reference into a VB DLL
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.
--
Edit Bug report at: http://bugs.php.net/?id=7116&edit=1