|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-04-27 12:02 UTC] arnout at argeweb dot nl
Description:
------------
I'm trying to pass a COM class into a member function of another COM class object. The second object chokes.
One class is the connection with the database.
The second is something that needs to connect.
Reproduce code:
---------------
$Conn = new COM("some.Conn");
$Conn->Connect( 'database', 'user', 'pass');
// this object is works fine.
$Customer = new COM("some.Customer");
$Customer->Connect( $Conn ); // KLABAM!
Expected result:
----------------
I'd expect the $Customer->Connect() function to accept the $Conn as being a "Conn" object and just connect.
Actual result:
--------------
"Error number: 97
Error description: Can not call friend function on object which is not an instance of defining class"
This error comes from the object.
The Customer->Connect function calls a friend function to do something with the Conn object. This function does not believe the object is a living Conn object and spittes it out.
The whole thing works perfectly in C, VC++, VB, Jscript, VBscript (ASP) and Delphi.
I've called the company that made the DLL, and they think the Conn object I pass isn't a real Conn object, but a simulation / emulation. Or a "COM" object of course.
I've tried converting it to a more MS-like thing with the VARIANT class, but it doesn't seem to do much good. (type mismatch)
So is this a PHP problem, or didn't the ones who made the DLL read the COM specifications too well?
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 16:00:02 2025 UTC |
The problem's still there. Fatal error: Uncaught exception 'com_exception' with message 'Source: PHPTest Description: Can not call friend function on object which is not an instance of defining class' in C:\Program Files\Apache Group\Apache2\htdocs\phptest.php:32 Stack trace: #0 {main} thrown in C:\Program Files\Apache Group\Apache2\htdocs\phptest.php on line 32I'm using Apache 2 and run 5.0.0RC2 as a module. Maybe that makes some difference? $Administration = new COM("PHPTest.Administration") or die("huh?"); $Customer = new COM("PHPTest.Customer") or die("what?"); echo $Customer->Connect( $Administration ); // Huge error