Bug #64130 [Com]: COM obj parameters passed by reference are not updated

From: Date: Wed, 06 Jan 2021 13:48:45 +0000
Subject: Bug #64130 [Com]: COM obj parameters passed by reference are not updated
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231399@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64130&edit=1

 ID:                 64130
 Comment by:         elukars at gmail dot com
 Reported by:        bmiller dot qw at gmail dot com
 Summary:            COM obj parameters passed by reference are not
                     updated
 Status:             Closed
 Type:               Bug
 Package:            COM related
 Operating System:   Windows
 PHP Version:        5.4.11
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

`
### wp-core ###

version: 5.6
site_language: en_US
user_language: en_US
timezone: +00:00
permalink: /%postname%/
https_status: false
multisite: false
user_registration: 0
blog_public: 1
default_comment_status: open
environment_type: production
user_count: 1
dotorg_communication: true

### wp-paths-sizes ###

wordpress_path: /home2/npmlnuym/public_html/blog
wordpress_size: 43.23 MB (45331627 bytes)
uploads_path: /home2/npmlnuym/public_html/blog/wp-content/uploads
uploads_size: 33.22 MB (34829151 bytes)
themes_path: /home2/npmlnuym/public_html/blog/wp-content/themes
themes_size: 2.53 MB (2652435 bytes)
plugins_path: /home2/npmlnuym/public_html/blog/wp-content/plugins
plugins_size: 38.82 MB (40706938 bytes)
database_size: 4.47 MB (4685824 bytes)
total_size: 122.27 MB (128205975 bytes)

### wp-active-theme ###

name: Docile (docile)
version: 1.0.7
author: templatesell
author_website: https://www.templatesell.com/
parent_theme: none
theme_features: core-block-patterns, automatic-feed-links, title-tag, post-thumbnails, menus, html5,
custom-logo, custom-background, customize-selective-refresh-widgets, responsive-embeds,
wp-block-styles, editor-font-sizes, custom-header, infinite-scroll, jetpack-responsive-videos,
jetpack-content-options, widgets
theme_path: /home2/npmlnuym/public_html/blog/wp-content/themes/docile

### wp-mu-plugins (1) ###

installatron_hide_status_test.php: author: (undefined), version: (undefined)

### wp-plugins-active (8) ###

Akismet Anti-Spam: version: 4.1.7, author: Automattic
Classic Editor: version: 1.6, author: WordPress Contributors
Jetpack by WordPress.com: version: 9.2.1, author: Automattic
Limit Login Attempts Reloaded: version: 2.18.0, author: Limit Login Attempts Reloaded
LiteSpeed Cache: version: 3.6.1, author: LiteSpeed Technologies
One Click Demo Import: version: 2.6.1, author: ProteusThemes
Pixelgrade Assistant: version: 1.3.2, author: Pixelgrade
Template Sell Demo Importer: version: 1.0.1, author: Template Sell

### wp-media ###

image_editor: WP_Image_Editor_GD
imagick_module_version: Not available
imagemagick_version: Not available
file_uploads: File uploads is turned off
post_max_size: 128M
upload_max_filesize: 128M
max_effective_size: 128 MB
max_file_uploads: 20
gd_version: bundled (2.1.0 compatible)
ghostscript_version: 9.25

### wp-server ###

server_architecture: Linux 3.10.0-962.3.2.lve1.5.42.el7.x86_64 x86_64
httpd_software: LiteSpeed
php_version: 7.4.11 64bit
php_sapi: litespeed
max_input_variables: 10000
time_limit: 30
memory_limit: 512M
max_input_time: 60
upload_max_filesize: 128M
php_post_max_size: 128M
curl_version: 7.72.0 OpenSSL/1.1.1h
suhosin: false
imagick_availability: false
pretty_permalinks: true
htaccess_extra_rules: true

### wp-database ###

extension: mysqli
server_version: 10.3.25-MariaDB-cll-lve
client_version: mysqlnd 7.4.11

### wp-constants ###

WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /home2/npmlnuym/public_html/blog/wp-content
WP_PLUGIN_DIR: /home2/npmlnuym/public_html/blog/wp-content/plugins
WP_MAX_MEMORY_LIMIT: 512M
WP_DEBUG: false
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: true
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_LOCAL_DEV: undefined
DB_CHARSET: utf8
DB_COLLATE: undefined

### wp-filesystem ###

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable
mu-plugins: writable

### jetpack ###

site_id: 187587383
ssl_cert: No
time_diff: 1
version_option: 9.2.1:1609690044
old_version: 9.2:1609633226
public: Public
master_user: #1 Eliass
current_user: #1 Eliass
tokens_set: Blog User
blog_token: L)zRCly5s&jdNyk3W^aL&gH4gullrsCp
user_token: 9&w@hU0a$RddSa0r%jWG!sj*SviZ%OF2
version: 9.2.1
jp_plugin_dir: /home2/npmlnuym/public_html/blog/wp-content/plugins/jetpack/
plan: free
protect_header:
{"trusted_header":"REMOTE_ADDR","segments":1,"reverse":false}
full_sync: {"started":"Sun, 03 Jan 2021 10:34:00
+0000","finished":"Sun, 03 Jan 2021 10:34:16
+0000","progress":{"options":{"finished":true},"functions":{"finished":true},"constants":{"finished":true},"users":{"total":"1","sent":1,"finished":true,"last_sent":"1"},"network_options":{"finished":true}},"config":{"options":true,"functions":true,"constants":true,"users":[1],"network_options":true}}
sync_size: undefined
sync_lag: 0 seconds
full_sync_size: undefined
full_sync_lag: 0 seconds
idc_urls: {"home":"http:\/\/www.hornpolitica.com\/blog","siteurl":"http:\/\/www.hornpolitica.com\/blog","WP_HOME":"","WP_SITEURL":""}
idc_error_option: false
idc_optin: true
cxn_tests: All Pass.

`


Previous Comments:
------------------------------------------------------------------------
[2020-11-07 18:01:31] cmb@php.net

Please file a new bug report about this issue.  Also, if possible,
please provide that DLL for download.

------------------------------------------------------------------------
[2020-11-07 17:34:48] fherrero at noticiasdenavarra dot com

I've a dll with a method with doble params:
  dll_method([out] dobule* DoubleParam);

When I call this method:
<?php
$double_param = (float) 0.1;
dll_method($double_param);

Throws this error:
Parameter 1: The types do not match.

When copy php_com_dotnet.dll from PHP-7.4.10 to PHP-7.4.11 (or 7.4.12) the are no error.

------------------------------------------------------------------------
[2020-08-26 12:58:06] cmb@php.net

Fixed as <http://git.php.net/?p=php-src.git;a=commit;h=5ff15e2651850ba30dde69056436b8774fac9166>.

------------------------------------------------------------------------
[2013-02-01 19:14:19] bmiller dot qw at gmail dot com

Description:
------------
I found that COM ByRef parameters where still being treated as ByVal parameters - only for "out
of process" com objects.

I debugged the COM extension (or COM_DOTNET) and found that in function;
php_com_get_id_of_name() (in com_com.c)  
was calling "hr = ITypeInfo_GetIDsOfNames(obj->typeinfo, &olename, 1, dispid);" to
get the com object dispatch id from the member name.

For out of process objects this will always return E_NOTIMPL. 
Thus the iTypeInfo object (obj->typeinfo) would be destroyed.
The final result would be that ByRef parameters would NOT be detected.

Easy fix; Just ALWAYS use the IDispatch_GetIDsOfNames and only use iTypeInfo for the
ITypeInfo_GetTypeComp call - which is what we need.



Test script:
---------------
//(need MS word) or any app that has a COM interface
$word = new COM("word.application") or die("Unable to instantiate Word");
$word->Visible = 1;
/*
In the com_com.c, place a breakpoint at: 
hr = ITypeInfo_GetIDsOfNames(obj->typeinfo, &olename, 1, dispid);
It will always return E_NOTIMPL then the code deletes obj->typeinfo which
ultimately causes the problem
*/

Expected result:
----------------
If the com object function call used references then the variable would be changed.
Sorry I couldn't find a public COM object off hand that passed variables by reference.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=64130&edit=1


Thread (6 messages)

« previous php.bugs (#231399) next »