ID: 27974 User updated by: e dot vandeoudeweetering at marcanti dot esprit-sg dot Reported By: e dot vandeoudeweetering at marcanti dot esprit-sg dot Status: Closed Bug Type: COM related Operating System: windows2000 (5.00.2185) sp4 PHP Version: 5.0.0RC2-dev 23-04-2004 06:30 Assigned To: wez New Comment:
Thanks for your support wez! Previous Comments: ------------------------------------------------------------------------ [2004-04-23 15:21:31] [EMAIL PROTECTED] What you describe now is expected behaviour; take a look at http://www.zend.com/php5/articles/php5-dotnet.php for more information on COM in PHP 5. The only problem now is that count() doesn't return sensible values for overloaded objects; this is a general issue and not COM specific (so it's a different bug). I'll see what can be done about that. ------------------------------------------------------------------------ [2004-04-23 13:33:53] e dot vandeoudeweetering at marcanti dot esprit-sg dot I installed the CVS version [5.0.0RC2-dev, 23 Apr 2004 06:30] and did the following tests: ### PHP Code ### <?php define("APPEND", 3); $adsi = "cn=user,ou=test,dc=php,dc=net"; $user = new COM("LDAP://" . $adsi); $arr = array("123", "456", "789"); $user -> PutEx(APPEND, "otherHomePhone", $arr); $user -> SetInfo(); $arr2 = $user -> GetEx("otherHomePhone"); ?> ### Test 1 ### $cnt = count($arr2); for($i = 0; $i < $cnt; $i++) { print $arr[$i] . "\n"; } //Only the 1st of 3 elements is printed //count function results 1. wrong! 3 elements in array ### Test 2 ### foreach($arr2 as $val) { print $val . "\n"; } //All 3 elements are printed! ### Test 3 ### print_r($arr2); //Results: variant Object The COM function PutEx on line 9 works fine!!! Active directory is updated with the correct values in array. The COM function GetEx on line 12 has a small problem. There's no array returned in the function, but an variant object. ------------------------------------------------------------------------ [2004-04-22 16:28:40] [EMAIL PROTECTED] My fix was too paranoid; I've updated it; please try the next snapshot. ------------------------------------------------------------------------ [2004-04-22 13:54:32] e dot vandeoudeweetering at marcanti dot esprit-sg dot Hi Wez, I installed the CVS version [5.0.0RC2-dev, 22 Apr 2004 08:32:53] and did the following tests: ### PHP Code ### <?php define("APPEND", 3); $adsi = "cn=user,ou=test,dc=php,dc=net"; $user = new COM("LDAP://" . $adsi); $arr = //See the test results! $user -> PutEx(APPEND, "otherHomePhone", $arr); $user -> SetInfo(); ?> ### Test 1 ### $arr = array("123", "456", "789"); PHP Warning: Unknown: COM: converting from PHP array to VARIANT array; only arrays with numeric keys are allowed in C:\php\includes\test.php on line 9 Exception thrown File : C:\php\includes\test.php Line : 9 Message : Source: Active Directory Description: Unspecified error Code : -2147352567 TraceString : #0 {main} ### Test 2 ### $arr = array(0 => "123", 1 => "456", 2 => "789"); PHP Warning: Unknown: COM: converting from PHP array to VARIANT array; only arrays with numeric keys are allowed in C:\php\includes\test.php on line 9 Exception thrown File : C:\php\includes\test.php Line : 9 Message : Source: Active Directory Description: Unspecified error Code : -2147352567 TraceString : #0 {main} As you see, both tests failed. I hope these tests will help you. Best regards, Edwin. ------------------------------------------------------------------------ [2004-04-22 02:52:13] [EMAIL PROTECTED] 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 comitted a probable fix; please try the next PHP snapshot (could be up to 3 hours away) and let me know how things go. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/27974 -- Edit this bug report at http://bugs.php.net/?id=27974&edit=1