logoon  windows
Apache Lounge
Webmasters

 


About

Forum Index Downloads Search Forum Register Log in  RSS Apache Lounge


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored by anyone.

Your donations will help to keep this site alive and well, and continuing the building of the binaries.




DCOM error on apache2.2.17+php5.3.6

 
Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner



View previous topic :: View next topic  
Author Message
yangshaoxing



Joined: 08 Jul 2010
Posts: 23

PostPosted: Thu 31 Mar '11 7:20    Post subject: DCOM error on apache2.2.17+php5.3.6 Reply with quote

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: 4988
Location: Germany, Next to Hamburg

PostPosted: Mon 11 Apr '11 13:00    Post subject: Reply with quote

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: 4988
Location: Germany, Next to Hamburg

PostPosted: Mon 11 Apr '11 13:20    Post subject: Reply with quote

Do you have a reference call in that VB function itsee÷f ? like

Code:

Public Function hello(param_1,param_2,param_3,&param_4,param_5,praram_6) As String
    ' ...
End Function
Back to top
yangshaoxing



Joined: 08 Jul 2010
Posts: 23

PostPosted: Tue 12 Apr '11 6:57    Post subject: my function nr Reply with quote

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: 4988
Location: Germany, Next to Hamburg

PostPosted: Tue 12 Apr '11 11:16    Post subject: Reply with quote

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

PostPosted: Wed 13 Apr '11 2:20    Post subject: Reply with quote

but it isn't reference call.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 4988
Location: Germany, Next to Hamburg

PostPosted: Wed 13 Apr '11 11:05    Post subject: Reply with quote

Whoops I messed up the code example Embarassed

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

PostPosted: Fri 15 Apr '11 2:28    Post subject: Reply with quote

but why not $param_2 = 1? the second parameter
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 1669
Location: Sun Diego, CA, USofA

PostPosted: Fri 15 Apr '11 6:18    Post subject: Reply with quote

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


Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner
Page 1 of 1