ID: 30178 Updated by: [EMAIL PROTECTED] Reported By: e dot vandeoudeweetering at marcanti dot esprit-sg dot -Status: Open +Status: Bogus Bug Type: COM related Operating System: Windows 2000 SP4 5.00.2195 PHP Version: 5.0.1 New Comment:
Your code looks broken, try this: for($i = 0; $nd -> Count(); $i += 2) { ^ This means, keep going for all eternity, since nothing ever changes the count. You want $i < $nd->Count() Previous Comments: ------------------------------------------------------------------------ [2004-09-21 13:47:16] e dot vandeoudeweetering at marcanti dot esprit-sg dot Description: ------------ To enumerate network drives or printer connections, a COM function 'EnumNetworkDrives()' or 'EnumPrinterConnections()'is used. When I run my script with 'EnumNetworkDrives()' as an example, an exception is thrown. This exception is also thrown when using the function 'EnumPrinterConnections()'. Reproduce code: --------------- <?php $network = new COM("WScript.Network"); $nd = $network -> EnumNetworkDrives(); for($i = 0; $nd -> Count(); $i += 2) { print $nd -> Item($i) . " " . $nd -> Item($i +1) . "\n"; } ?> Expected result: ---------------- G: \\%SERVER%\%SHARE% I: \\%SERVER%\%SHARE% J: \\%SERVER%\%SHARE% K: \\%SERVER%\%SHARE% L: \\%SERVER%\%SHARE% M: \\%SERVER%\%SHARE% Actual result: -------------- G: \\%SERVER%\%SHARE% I: \\%SERVER%\%SHARE% J: \\%SERVER%\%SHARE% K: \\%SERVER%\%SHARE% L: \\%SERVER%\%SHARE% M: \\%SERVER%\%SHARE% PHP Fatal error: Uncaught exception 'com_exception' with message 'Source: Unknown Description: Unknown' in C:\Scripts\php\drives.php:6 Stack trace: #0 {main} thrown in C:\Scripts\php\drives.php on line 6 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30178&edit=1