php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #24465 No abilty to assign value to object array
Submitted: 2003-07-02 15:01 UTC Modified: 2018-07-16 12:19 UTC
Votes:5
Avg. Score:3.0 ± 1.3
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: artpego at hotmail dot com Assigned:
Status: Suspended Package: COM related
PHP Version: 4.3.2 OS: Windows XP SP1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: artpego at hotmail dot com
New email:
PHP Version: OS:

 

 [2003-07-02 15:01 UTC] artpego at hotmail dot com
Description:
------------
This is caused while using the "RFC_READ_TABLE" remote function call for SAP R/3. The ability to add a value to a temporary table at a specified row and column is required.






Reproduce code:
---------------
$funSap=new COM("SAP.Functions") or die ("Did Not Create");
$myFun=$funSap->Add("RFC_READ_TABLE");
$optionAdd=$myFun->Tables("OPTIONS");
$optionAdd->AppendRow();
$optionAdd(1,"TEXT")="FCURR = 'NTD'";

Expected result:
----------------
The script above supposed to do the following:

a) $optionAdd=$myFun->Tables("OPTIONS")
## CREATE A TABLE NAMED OPTIONS.

b) $optionAdd->AppendRow()
## METHOD CALLED TO ADD A BLANK ROW TO THE OPTIONS TABLE

c) $optionAdd(1,"TEXT")="FCURR = 'NTD'"
## ASSIGN THE VALUE "FCURR = 'NTD'" TO THE OPTIONS TABLE (ROW 1, COLUMN1)==(1,"TEXT")

Actual result:
--------------
## ERROR -> parse error, unexpected '=' in line ...
This is due to the line $optionAdd(1,"TEXT")="FCURR = 'NTD'"

I have tried countless combinations, read every piece of documentation, searched the internet for over a week and can see exambles in every other language doing exactly this with COM objects (VB,Java,PERL,Etc).

Every other part of the script works
a) I can connect to SAP
b) I can query functions and tables and get results

However: If I am unable to use the portion of the script listed above, there is no way to limit my queries through a "WHERE CLAUSE" or even select specific fields... This means my query results would return every row from the entire table (some have millions of entries) and there is a buffer width of 512 Bytes that can not be exceeded for each row. Your assistance will be greatly appreciated.

Michael

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-02 21:38 UTC] sniper@php.net
Learn PHP syntax first.

 [2003-07-03 00:45 UTC] artpego at hotmail dot com
Do not dismiss this so quickly as not understanding PHP syntax. I am a very compentant PHP coder for a large company (a company which I am trying to show that PHP can replace their horrible asp/VB systems for accessing SAP). I understand PHP syntax very well and that using:
$optionAdd(1,"TEXT")="FCURR = 'NTD'";
Will cause a parse error ##using an equal '=' sign after what php would see as a funtion call is impossible## None the less, I have not found a way to assign this value. The 
whole point is that I have to assign a value to a co-ordinate:

TABLE   COL1
ROW1  #VALUE#

this co-oridinate/value is represented by (1,1)

I can retrieve the default value assigned to this co-ordinate by using:

$myValue=$optionAdd->value(1,1); ## LEGAL, I get my value back

I am unable to ASSIGN a value since every time I try it would be hurting the parser's feelings or breaking the metods rules.

$optionAdd->value(1,1)="Some Text"; Unexpected '=' Error
$optionAdd->value="Some Text"; propput failed invalid index
$optionAdd->appendRow(1,1);
$optionAdd="Some Text"; Invalid number of arguments appendRow

The list goes on and on. I have spent more time than I can imagine hunting for ways to modify my script. I have researched the SAP COM methods for alternate solutions, I have studied examples in every other language, I tried everything I know how to do. I cannot do this. If you it is as simple as not understanding PHP syntax, then show me how it is done, otherwise, tell me why it can't be done.
 [2003-07-03 03:51 UTC] postings-php-bug at hans-spath dot de
Maybe this helps you:
http://www.phpbuilder.net/columns/alain20001003.php3?page=3
Look for "$cell".

However, I think this is not a bug, but a support question. So this is not the appropriate place to ask.
 [2003-07-03 03:56 UTC] derick@php.net
Right
 [2003-07-03 03:58 UTC] wez@php.net
PHP does not currently support this kind of thing.
PHP 5 *should* allow it using [] array access, but it does not yet.
Suspending this until the required hooks are present in the engine.
 [2003-07-03 07:16 UTC] artpego at hotmail dot com
Thank You All for your replies. I have written an Excel-to-tsv program and the cell method syntax is similar; however, the method works nothing like this. 
Yes, I thought it would be something like [], but, I have tried using [] && {}; however, it treats it simply as an array and of course complains when you add a comma [1,1]. I just mainly wanted to make sure I had not lost my mind! Atleast knowing that this *May* be supported in the future is a big relief. Again, Thank you.
 [2018-07-16 12:19 UTC] cmb@php.net
-Package: Feature/Change Request +Package: *General Issues
 [2018-07-16 12:19 UTC] cmb@php.net
-Package: *General Issues +Package: COM related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC