ID: 25759 Comment by: david at replicant dot org dot uk Reported By: david dot nicholls at camden dot gov dot uk Status: Open Bug Type: COM related Operating System: Windows 2000 PHP Version: 5CVS-2003-10-06 (dev) New Comment:
Many thanks for your time. The foreach contruct use appeals to my sensibilites much more than the while one. Hope the proding gets the results :) - i'm stuck at the momement as PHP4 wont be changed to fix to a show stopping bug and 5 wont work yet. Previous Comments: ------------------------------------------------------------------------ [2003-10-07 09:23:35] [EMAIL PROTECTED] of course, I meant this: foreach ($comUsers as $user) { $uClass = $user->Class; $uName = $user->Name; echo "$uName \t $uClass \n\r"; } I'll look into the API docs for ADSI later to sanity check my other comments also. ------------------------------------------------------------------------ [2003-10-07 09:21:29] [EMAIL PROTECTED] One of the differences between PHP 4 COM and PHP 5 COM is that PHP doesn't do magic for IEnumXXX interfaces, and that is what I suspect the problem is here. That means that the magical $obj->next() stuff won't work, and should never have worked in the first place, because they aren't really methods of the com object, but of an iterator interface. (The PHP 4 COM stuff had quite a few of these hacks). The plan for PHP 5 is to allow this: foreach ($comUsers as $user) { $uClass = $obj->Class; $uName = $obj->Name; echo "$uName \t $uClass \n\r"; } but to implement that, I'm waiting for some engine magic, so I'll prod the relevant people about it. ------------------------------------------------------------------------ [2003-10-07 08:52:52] david dot nicholls at camden dot gov dot uk Its one of the usefule errors :) C:\Inetpub\wwwroot\ntadmin>php comtest.php Content-type: text/html X-Powered-By: PHP/5.0.0b2-dev Making COM connection using ADSI WinNT://Camden Boundexception Object ( [message:protected] => Unknown exception [string:private] => [code:protected] => 0 [file:protected] => C:\Inetpub\wwwroot\ntadmin\comtest.php [line:protected] => 12 [trace:private] => Array ( ) [message] => <b>Source:</b> Active Directory<br/><b>Description:</b> Unspecified error [file] => C:\Inetpub\wwwroot\ntadmin\comtest.php [line] => 12 ) C:\Inetpub\wwwroot\ntadmin> Line 12 is the 'while' line ------------------------------------------------------------------------ [2003-10-07 08:45:46] [EMAIL PROTECTED] Put the try { } catch () stuff around the whole of your script and lets see what's going wrong. (Yes, PHP should at least tell you about the uncaught exception; that appears to be another bug) ------------------------------------------------------------------------ [2003-10-07 07:42:00] david dot nicholls at camden dot gov dot uk Should add fails silently after echoing 'Bound' to console ------------------------------------------------------------------------ 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/25759 -- Edit this bug report at http://bugs.php.net/?id=25759&edit=1