|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-07-28 23:30 UTC] awsewell at catawba dot edu
Description:
------------
When trying to use php 5.04 to access the registry with the code below PHP crashes.
Reproduce code:
---------------
<?php
$hostname = ".";
$keyPath = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
$wshShell = new COM("winmgmts:{impersonationLevel=impersonate}//{$hostname}/root/default:StdRegProv");
$wshShell->EnumKey("HKEY_LOCAL_MACHINE", $keyPath, $keys);
foreach($keys as $key){
print $key;
}
unset($wshShell);
?>
Expected result:
----------------
I execpt to see the list of subkeys from the registry.
Actual result:
--------------
PHP crashes with only "CLI has encountered a problem and needs to close. We are sorry for the inconvenience."
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 16:00:01 2025 UTC |
Doesn't seem to work on the latest beta of PHP5, but it works on PHP4... <?php define('HKEY_LOCAL_MACHINE',0x80000002); $keys = new VARIANT('', VT_ARRAY); $hostname = "."; $keyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"; $wshShell = new COM("winmgmts:{impersonationLevel=impersonate}//{$hostname}/root/default:StdRegProv"); $wshShell->EnumKey(HKEY_LOCAL_MACHINE, $keyPath, &$keys); $keys = $keys->value; foreach($keys as $key){ print "$key\n"; } ?>