|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72922 COM called from PHP does not return out parameters
Submitted: 2016-08-22 14:55 UTC Modified: 2016-09-23 14:05 UTC
From: mistr111 at yahoo dot com Assigned: ab (profile)
Status: Closed Package: COM related
PHP Version: 7.0.10 OS: Windows Server 2008 R2 Standard
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: mistr111 at yahoo dot com
New email:
PHP Version: OS:


 [2016-08-22 14:55 UTC] mistr111 at yahoo dot com
I have a problem concerning COM support in PHP 7.
I have been using COM called from PHP applications for a very long time.
After calling new COM(... , I used to call methods with several in/out parameters.
The result is used just to check status of the call but data is extracted from in/out parameters.
Everything has worked just fine in different PHP versions for almost a decade till I tried PHP 7.
I am able to call methods and can access results without problems, but in/out parameters stay the same after the call.
I carried out tests on the same machine with PHP 5.6 and everything worked OK.
When I switched to PHP 7 or beta PHP 7.1, output parameters were unaffected only result was correctly filled out.
(It did not matter whether I used 32-bit or 64-bit versions).

I used Windows Server 2008 R2 Standard for testing.
Binaries for PHP from and (PHP 7.0.10 - VC14 x86 Thread Safe, VC14 x64 Thread Safe and PHP 7.1.0 beta2)
For Apache from (Apache 2.4.23 Win64, Apache 2.4.23 Win32)
with appropriate,latest C++ Redistributables installed
I combined 32-bit versions of COM, Apache, PHP and then 64-bit versions with the same result. 

Test script:
$comTest = new COM("comTest.comTestIF") or die("Unable to instantiate comTest");
$result = $comTest->test($parIn,$parOut1,$parOut2);
// after the call $parOut1,$parOut2 parameters are unaffected although they are changed inside com. Only result is correct


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-22 17:04 UTC]
-Status: Open +Status: Feedback
 [2016-08-22 17:04 UTC]
Thanks for the report. Please post the test class, or better a test project, along with the way you register the class and other setup. Also need the current/expected output to compare.

 [2016-08-23 07:23 UTC] mistr111 at yahoo dot com
-Status: Feedback +Status: Open
 [2016-08-23 07:23 UTC] mistr111 at yahoo dot com
Hello, thanks for responding so quickly.

COM registration:
regsvr32 comTest.dll

comTest.dll is created in Embarcadero® Delphi 10 Seattle Version 23.0.21418.4207
(I have used COM objects created even in older versions of Delphi for almost a decade and it worked fine).
comTest.dll was created just for testing purposes. I tested this exact version today with php 5.6 on the same server and it worked OK.
Then with proper VC14 Win32 version of Apache and VC14 x86 PHP 7.0.10 and it returns correct result, but in/out parameters keep input values instead of values provided inside COM.
I will send you an e-mail with the Delphi project (contains dlls - both Wind32 and Win64 versions) and description of both php and apache setups(I do not know how to enclose it here).
The php test script and outputs for both versions will be enclosed. Both setups use 32-bit versions but results for 64-bit versions are the same.

Method in COM object:

function TcomTestIF.test(const Param1: WideString; var Param2, Param3: WideString): WideString;
var res : string;
  res := 'Param1=' + Param1 + '; Param2=' + Param2 + '; Param3=' + Param3;
  Param2 := 'Output text Param2';
  Param3 := 'Output text Param3';
  Result :=  res;
 [2016-08-25 10:15 UTC]
Automatic comment on behalf of ab
Log: Fixed bug #72922 COM called from PHP does not return out parameters
 [2016-08-25 10:15 UTC]
-Status: Open +Status: Closed
 [2016-09-21 21:29 UTC] a at kornienko dot ru
In 7.0.11 has stopped working COM, which worked well in 7.0.10. The 500 error.
 [2016-09-22 21:26 UTC] a at kornienko dot ru
I searched the line with the error. That's the line began to give an error on 7.0.11:

This method should return a value.
 [2016-09-23 14:05 UTC]
-Assigned To: +Assigned To: ab
 [2016-09-23 14:05 UTC]
@a at kornienko dot ru, please check the latest snapshots. If you still experience the issue, please create a separate ticket and include the reproduce code.

 [2016-10-17 10:09 UTC]
Automatic comment on behalf of ab
Log: Fixed bug #72922 COM called from PHP does not return out parameters
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Sep 27 08:05:51 2022 UTC