|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-07-17 14:20 UTC] tommy_wei at hotmail dot com
Description:
------------
I found something strange with COM Object but I'm not sure.
My System
- Windows 2000-2003 Server & XP Pro sp2
- IIS ISAPI
- PHP 5.0.4 & 5.1.0b3 & 5.1.0Dev-200507170630
My code...
<?php
try{
$com=new COM("Automation_Users");//My Company ActiveX
$index=$com->IndexOf($user);
$target=$com->Items($index);//return user object
$target->Password="password";
$com->Items($index)=$target;//to update user's information
unset($com);
}catch(Exception $exp){
echo $exp->getMessage();
}
?>
The problem is at the line -> $com->Items($index)=$target;
- PHP 5.0.4
$com->Items($index)=$target;
Error -> Fatal error: Can't use method return value in write context in D:\Project\PHP\Project\functions.php on line 580
I don't know why because this works fine with ASP
I changed the code to...
$com->Items[$index]=$target;
It works ! I don't understand why it works ?
I never used [] to pass parameter with any COM object.
- PHP 5.1.0b3 & 5.1.0Dev doesn't work any way both ($index) [$index]
$com->Items($index)=$target;
Error -> Fatal error: Can't use method return value in write context in D:\Project\PHP\Project\functions.php on line 580
$com->Items[$index]=$target;
Error -> [0x8002000e] Invalid number of parameters.
This made me confuse -"-
---------------------------------------
I'm not sure this is a bug of my company's activeX or PHP
If you need more information please tell me.
Thank you.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 10:00:02 2025 UTC |
Ok you are right... You said -> The long answer is that atm we cannot support the ()= syntax and offer the []= as an alternative But why this code doesn't work with PHP 5.1.0b3 & The lastest CVS 5.1.0Dev...it works for PHP 5.0.4 <?php try{ $com=new COM("Automation_Users");//My Company ActiveX $index=$com->IndexOf($user); $target=$com->Items[$index];//return user object $target->Password="password"; $com->Items[$index]=$target;//to update user's information unset($com); }catch(Exception $exp){ echo $exp->getMessage(); } ?> At line >> $target=$com->Items[$index]; Error is >> [0x8002000e] Invalid number of parameters. Any idea ?