ID:               25759
 Updated by:       [EMAIL PROTECTED]
 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:

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.


Previous Comments:
------------------------------------------------------------------------

[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

------------------------------------------------------------------------

[2003-10-07 07:40:27] david dot nicholls at camden dot gov dot uk

The bug fix worked thanks and I can now do the instatitaion. However
there are issues at the next stage :(

This works under 4 and not 5 

I suspect "while($obj = $comUsers->Next())" (dont know how to put in
the exception handling code there)


<?php
$acctDomain = "Camden";
echo "Making COM connection using ADSI\n\r";
$acctStr = "WinNT://".$acctDomain;
echo "$acctStr\n\r";

$comUsers = new COM($acctStr);
echo "Bound";

while($obj = $comUsers->Next()) {
        $uClass = $obj->Class;
        $uName = $obj->Name;
        echo "$uName \t $uClass \n\r";
}
?>

------------------------------------------------------------------------

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

Reply via email to