Bug #72569 [Com]: DOTNET/COM array parameters broke in PHP7 (regresion)
| From: | deivid dot garcia dot garcia at gmail dot com | Date: | Tue, 12 Jul 2016 13:43:39 +0000 |
| Subject: | Bug #72569 [Com]: DOTNET/COM array parameters broke in PHP7 (regresion) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202238@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72569&edit=1
ID: 72569
Comment by: deivid dot garcia dot garcia at gmail dot com
Reported by: deivid dot garcia dot garcia at gmail dot com
Summary: DOTNET/COM array parameters broke in PHP7
(regresion)
Status: Feedback
Type: Bug
Package: COM related
Operating System: Windows 10.1
PHP Version: 7.0.8
Block user comment: N
Private report: N
New Comment:
Works. Thanks!
Previous Comments:
------------------------------------------------------------------------
[2016-07-12 13:01:23] ab@php.net
Thanks for making repro so easy :) I've just pushed a fix to this, could you please check these
builds with your app? http://windows.php.net/downloads/snaps/ostc/72569/
Thanks.
------------------------------------------------------------------------
[2016-07-12 12:59:42] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3e8dbb3e5d763166e6f03903c931161d5f2706ed
Log: Fixed bug #72569 DOTNET/COM array parameters broke in PHP7
------------------------------------------------------------------------
[2016-07-11 15:41:00] deivid dot garcia dot garcia at gmail dot com
I was able to investigate this further and it looks like the issue is not strictly related to the
fact that an array is being passed, but that the array contains at least *one* reference.
I have built a demo script + dll and posted instructions on this Github repo:
https://github.com/david-garcia-garcia/72569test
What happens is that, if you pass an array to .Net, and any of the elements inside the array is a
reference, then the whole array arrives to .Net as full of NULLS (keeping the original length
though).
This did not happen in previous versions of PHP.
If you run the script in PHP 5.6 x86 NTS and PHP 7.0.8 NTS x64 you will se that it outputs different
data.
Thanks!
------------------------------------------------------------------------
[2016-07-11 13:22:50] ab@php.net
Thanks for the report. I'm willing to fix this issue, but lack on a way to reproduce. Could you
please supply a complete code for the C# class and the way to bind it in PHP, so debugging can be
done?
Thanks.
------------------------------------------------------------------------
[2016-07-09 20:08:31] deivid dot garcia dot garcia at gmail dot com
Description:
------------
Arrays passed to .Net when calling .Net object methods using COM class (probably DOTNET too but have
not tested) arrive as empty arrays.
This was NOT happening in PHP < 7, it's a regression. Other simple types are passed on
properly (such as strings).
Test script:
---------------
The bug CANNOT be demonstrated without building a specific .Net dll that takes an array as input.
In .Net:
public object MyNiceMethod(object[] parameters)
{
// In PHP7 parameters comes in as an EMPTY array
// when in PHP < 7 it was an array of string, integers and whatever
// you passed in from PHP.
}
In PHP:
$a = new COM("{CLASSID}");
$a->MyNiceMethod(["string1", "string2", 56, "string3", [1, 2, 3]]);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72569&edit=1