From: hargael at gmail dot com
Operating system: Windows XP
PHP version: 5.2.5
PHP Bug Type: COM related
Bug description: Strange Behavior of PHP using COM Object
Description:
------------
I've a problem with COM objects.
It's very similar to the bug #33734. In fact, I think that it is the same
problem but the bug is supposed to be fixed since 5.1.0. I use the 5.2.5
and have the same problem.
Excuse me for my clumsy english, I hope that my report will be readable.
Reproduce code:
---------------
Here is the code :
<?php
// Creation of the COM object $obj_persist
$obj_persist = new COM("PERSIST.PersistCtrl.1")or die("Error");
$obj_appli = $obj_persist->Applications->Add($path);
$obj_unite = $obj_appli->Units->Add("foo");
$obj_instance = $obj_unite->objects->add($nom_instance);
$sous_objet = $obj_instance->collection("Objects");
$propriete = $sous_objet->Item("alm");
echo "Label Value : " . $propriete->Value("Label",0); //Returns the good
Value
// Test 1
$propriete->Value("Label",0) = "New Label";
// Fatal Error
//Test 2
$propriete->Value["Label",0] = "New Label";
// Invalid number of parameters.
Expected result:
----------------
I've tried many ways of writing the $propriete->Value["Label",0]. With (),
[], mix of both. I cannot write on the value.
I though it was a read-only value but when I tried with VBa, it worked
perfectly. Here is the code.
Dim SsObjs as PrsCollObjects
Set SsObjs = MyInst.Collection("Objects")
Set MyObject = SsObjs.Item("Fault")
MyObject.Value("Label", 0) = "Défaut pompe 1"
Actual result:
--------------
Result of TEST 1 with () :
Fatal error: Can't use method return value in write context in
C:\wamp\www\Test COM\index.php on line 71
Result of TEST 2 with [] :
Fatal error: Uncaught exception 'com_exception' with message 'Error
[0x8002000e] Nombre de param?tres non valide. ' in C:\wamp\www\Test
COM\index.php:69 Stack trace: #0 C:\wamp\www\Test COM\index.php(69):
unknown() #1 {main} thrown in C:\wamp\www\Test COM\index.php on line 69
Depending on the way I write with [], I also have an "Unexpected ','"
error.
--
Edit bug report at http://bugs.php.net/?id=44578&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44578&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44578&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44578&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44578&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44578&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44578&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44578&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44578&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44578&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44578&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44578&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44578&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44578&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44578&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44578&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44578&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44578&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44578&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44578&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44578&r=mysqlcfg