Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: DCOM error on apache2.2.17+php5.3.6 |
|
Author |
|
yangshaoxing
Joined: 08 Jul 2010 Posts: 23
|
Posted: Thu 31 Mar '11 7:20 Post subject: DCOM error on apache2.2.17+php5.3.6 |
|
|
when i run my php program in ie,it said "Fatal error:Cannot pass parameter 4 by reference in abc.php on line 2"
the source is
<?
$zj=new COM("ABC.test");
$jg=$zj->nr("abc",1,"test",3,0,4);
echo $jg;
?>
the DCOM is programed by Visual Basic 6.0,ActiveX EXE server.
can everyone help me? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 11 Apr '11 13:00 Post subject: |
|
|
Can you give us a download link to the server? So I might try to reproduce it and might solve this? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 11 Apr '11 13:20 Post subject: |
|
|
Do you have a reference call in that VB function itseeƶf ? like
Code: |
Public Function hello(param_1,param_2,param_3,¶m_4,param_5,praram_6) As String
' ...
End Function
|
|
|
Back to top |
|
yangshaoxing
Joined: 08 Jul 2010 Posts: 23
|
Posted: Tue 12 Apr '11 6:57 Post subject: my function nr |
|
|
the function is:
public function nr(byval cs1 as string,byval cs2 as integer,byval cs3 as string,optional byval cs4 as integer=0,optional byval cs5 as integer=0,optional byval cs6 as integer=0) as string
.......
end function
by the way,there is no program in php5.2.17 |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 12 Apr '11 11:16 Post subject: |
|
|
Sorry, I was a bot confused. You can not pass a number as parameter. You need to put it into a variable before or use a string.
See http://php.net/manual/en/language.references.pass.php
So use
Code: |
<?php
$zj=new COM("ABC.test");
$param_4 = 3;
$param_5 = 0;
$param_6 = 4;
$jg=$zj->nr("abc",1,"test",3,0,4);
echo $jg;
?>
|
|
|
Back to top |
|
yangshaoxing
Joined: 08 Jul 2010 Posts: 23
|
Posted: Wed 13 Apr '11 2:20 Post subject: |
|
|
but it isn't reference call. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 13 Apr '11 11:05 Post subject: |
|
|
Whoops I messed up the code example
Code: |
<?php
$zj=new COM("ABC.test");
$param_4 = 3;
$param_5 = 0;
$param_6 = 4;
$jg=$zj->nr("abc",1,"test",$param_4,$param_5,$param_6);
echo $jg;
?>
|
You can't pass an integer directly |
|
Back to top |
|
yangshaoxing
Joined: 08 Jul 2010 Posts: 23
|
Posted: Fri 15 Apr '11 2:28 Post subject: |
|
|
but why not $param_2 = 1? the second parameter |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Fri 15 Apr '11 6:18 Post subject: |
|
|
I'm watching this as an FYI for me. I assume passing the int "raw" is a php quirk, since the error speaks of reference (which I read as a pointer in C speak), but what about?
$jg=$zj->nr("abc","1","test","3","0","4");
Been too long since I've passed anything to an ActiveX DLL but they are declared in the DLL as an int, it's getting integers in this case just telling php to treat as a string. What happens ... KABOOM? |
|
Back to top |
|
|
|
|
|
|