php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40424 Fatal error when setting the value of COM object's property array
Submitted: 2007-02-10 00:36 UTC Modified: 2019-11-03 04:22 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: lee at dark-circuit dot com Assigned: cmb (profile)
Status: No Feedback Package: COM related
PHP Version: 5CVS-2007-02-10 (snap) OS: Windows XP SP2
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lee at dark-circuit dot com
New email:
PHP Version: OS:

 

 [2007-02-10 00:36 UTC] lee at dark-circuit dot com
Description:
------------
Fatal error when setting the value of COM object's property array

Basically I'm having the same problem as Bug #28161 [This bug is marked closed, fixed]

http://bugs.php.net/bug.php?id=28161&edit=1

COM Array Assignment isn't working. 

In the old closed bug, wez posted a fix that went into RC2 of PHP 5.0, but I'm guessing that the fix didn't make it into release 5.0 or any current versions.  Have tested code on most currentish snaps of PHP 5.0 - 5.2.2 for sanity.

Reproduce code:
---------------
$itemindex = 2914;
$oInfo = new COM("PAW.LineItem") or die("WHAT THE?");

$oInfo->GetForIndex($itemindex); 
// CustomField is: 
// string  CustomField(ByVal Index As Integer)

echo $oInfo->CustomField[1];

echo "\n";
$oInfo->CustomField[1] = "PIE";

echo "\n";
echo $oInfo->CustomField[1];


Expected result:
----------------
CAKE

PIE

CAKE



Actual result:
--------------
CAKE

PHP Fatal error:  Uncaught exception 'com_exception' with message
'Error [0x8002000f] Parameter not optional.
' in C:\New Folder\prime-sync-itemdb.php:197
Stack trace:
#0 C:\New Folder (3)\prime-sync-itemdb.php(197): unknown()
#1 {main}
  thrown in C:\New Folder\prime-sync-itemdb.php on line 197

Note: for sanity I confirmed assignment works to same property by writing same program in VB.NET. Works ok.
oInfo.CustomField(1) = "PIE" in VB.NET

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-10 04:31 UTC] lee at dark-circuit dot com
sorry, messed up expected result slightly. Should be:

Expected result:
----------------
CAKE

PIE

PIE
 [2007-04-12 15:13 UTC] wharmby@php.net
Please try using this CVS snapshot:

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

Hi Lee
       Is this still an issue for you with latest 5.2 snapshot
builds ? 

With snapshot build of April 10th 2007 I am unable to recreate the
issue your report in this defect. Unfortunatley I do not have the pre-requisite software (PawCom and Peachtree accounting software ?) 
to run your supplied testcase so I have hacked togther one which I 
believe does something very similar using Excel as follows: 

<?php

if (file_exists("c:/COM/Sample2.xls")) {
	unlink("c:/COM/Sample2.xls");
}
	
$excel = new COM('Excel.Application') or die('Start Excel automation failed.'); 
$wbook = $excel->Workbooks->Open("c:/COM/Sample.xls");
$sheet = $wbook->ActiveSheet;
$cells = $sheet->Cells;

print $cells[3][2];echo "\n";

$cells[3][2] = "999999";     
print $cells[3][2];echo "\n"; 

$wbook->Close(true, "c:/COM/Sample2.xls");
$excel = null; 

echo "Test passed\n";     
?>

This both reads and writes a multi-dimension array with no problems which suggests to me the problem  has either been fixed in PHP in the
interim or its not a simple case of COM array assignment not working. 

Also, the error message you get 

	 "Error [0x8002000f] Parameter not optional" 

suggests something specific to the property you are trying to modify.

If you still have a problem with latest snapshot is there anyway you can  provide a standalone testcase so I can recreate the issue locally.

Regards
	Andy 
 [2007-04-16 22:45 UTC] lee at dark-circuit dot com
Still Getting same problem on suggested snapshot, will put together a test case as soon as possible.
 [2017-10-24 03:32 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: wharmby +Assigned To:
 [2019-10-21 10:24 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2019-10-21 10:24 UTC] cmb@php.net
Is this still an issue?
 [2019-11-03 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 12:01:27 2024 UTC