php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28161 Fatal error when setting the value of COM object's Attribute property array
Submitted: 2004-04-26 18:00 UTC Modified: 2004-04-29 05:59 UTC
From: spymail at 21cn dot com Assigned:
Status: Closed Package: COM related
PHP Version: 5.0.0RC2 OS: Windows 2000 AS
Private report: No CVE-ID: None
 [2004-04-26 18:00 UTC] spymail at 21cn dot com
Description:
------------


The COM runs well in ASP:

<%asp

'The Attribute property specifies and retrieves name-value pairs.
'
'Syntax:
'
'Header.Attribute(bstrName) = String
'String = Header.Attribute(bstrName)
'
'Parameters: bstrName [in] ,String containing the attribute name. 
'
'Attribute names are case-sensitive, and both the name and value must be specified in a valid 'XML format. If you duplicate an existing attribute, the earlier attribute is updated.

Dim rid
rid = "0"
Set headobj = Server.CreateObject("Wmrmobjs.WMRMHeader")
headObj.Attribute("RID") = rid 

%>


But when I convert it to PHP,there's a fatal error.



Reproduce code:
---------------
<?php
$rid=0;
$headObj = new COM("Wmrmobjs.WMRMHeader");
$headObj->Attribute["RID"] = $rid;
?>

Expected result:
----------------
The Attribute should be set.

Actual result:
--------------
There's a Error:

Fatal error: Uncaught exception 'com_exception' with message 'Error Invalid
number of arguments' in D:\server\abc.php:3 Stack trace: #0 {main} thrown in D:\server\abc.php on line 3

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-26 19:03 UTC] wez@php.net
Did you try RC2 ?

Can you please paste the IDL for the COM object here,
as I don't have that COM object to test against.

 [2004-04-27 04:35 UTC] spymail at 21cn dot com
Oh yes, I tried RC2 today, same output.

and here is the IDL:

[id(0x000007), propget, helpstring ("property Attribute")]
HRESULT Attribute([in] BSTR bstrName, [out, retval] BSTR* pVal);
[id(0x000007), propput, helpstring ("property Attribute")]
HRESULT Attribute([in] BSTR bstrName, [in] BSTR pVal);
 [2004-04-28 10:26 UTC] wez@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

I've just committed a fix for this; please try the next snapshot dated after this comment and let me know how you get on.

See the commit message here:
http://news.php.net/article.php?group=php.cvs&article=27208
 [2004-04-29 05:59 UTC] spymail at 21cn dot com
Thanks,wez,

Well done.

It works pretty well in the latest CVS win32 bulid (Apr 29 2004 04:12:53).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC