php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19192 Array consists of only one value
Submitted: 2002-08-30 04:09 UTC Modified: 2002-10-04 02:53 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:3 (100.0%)
From: mario dot schmidt at mediavillage dot de Assigned:
Status: Closed Package: COM related
PHP Version: 4.2.2 OS: NT, 2000, XP
Private report: No CVE-ID: None
 [2002-08-30 04:09 UTC] mario dot schmidt at mediavillage dot de
Following code "should" list all NT-Usergroups of the given machinename or nt-domain. This works with ASP but not PHP :(...

Array $objComputer is created but it only consists of one recordset (the first one, the machine itself). But there should be more in it! (Groups, Users, Services)

<?php
$objComputer = new COM("WinNT://machinename");

echo $objComputer->Name." is a ".$objComputer->Class." and has following NT-Groups:<p>";

$objComputer->filter = array("Group");
foreach($objComputer as $group)
{
	print $group->name."<br>\n";
}

echo "Group listing complete.";
?>


And here the WORKING Code using ASP:

<% 
Set GroupObj = GetObject("WinNT://machinename")
   
strFilter = Array("Group") 
BaseObj.Filter= strFilter

Response.write "---- Select a Group ----<p>"
For Each Member in BaseObj
    Response.write Member.Name & "<br>"
Next
%>

BTW: "WinNT://" is a VALID COM-Data Provider!!!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-05 15:46 UTC] kalowsky@php.net
I don't remember if anything has been backported to it or not, but any chance you can test against the 4.2.3RC's and see if this still continues.
 [2002-09-26 19:52 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-10-04 02:53 UTC] phanto@php.net
foreach only works with arrays, try

while ($group = $objComputer->Next()) {
...
}
 [2002-10-04 02:53 UTC] phanto@php.net
foreach only works with arrays, try

while ($group = $objComputer->Next()) {
...
}
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Oct 07 22:05:53 2022 UTC