#29747 [Opn->Bgs]: Fatal error on COM registry read.
| From: | wez@php.net | Date: | Fri, 10 Sep 2004 11:51:34 +0000 |
| Subject: | #29747 [Opn->Bgs]: Fatal error on COM registry read. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-66007@lists.php.net to get a copy of this message | ||
ID: 29747
Updated by: wez@php.net
Reported By: radek at pinkbike dot com
-Status: Open
+Status: Bogus
Bug Type: COM related
Operating System: Windows XP
PHP Version: 5CVS-2004-08-19 (dev)
New Comment:
Use exception handling.
Not a PHP bug.
Previous Comments:
------------------------------------------------------------------------
[2004-08-19 02:22:29] radek at pinkbike dot com
Description:
------------
Fatal error using the 'WScript.Shell' COM when accessing the registry
on WIndows XP. Tried 5.0 RC3, 5.0, and latest Apache/1.3.31 (Win32)
PHP/5.0.2-dev with same results.
Reproduce code:
---------------
This works correctly (reading a valid registry entry)
$shell= &new COM('WScript.Shell');
$data=$shell->regRead('HKEY_CURRENT_USER\Environment\TEMP');
The following causes a fatal error if the registry key does not exist
$shell= &new COM('WScript.Shell');
$data=$shell->regRead('HKEY_CURRENT_USER\Environment\TEMP11111');
This used to work correctly in 4.x versions of PHP.
Expected result:
----------------
Not to get a fatal error but a NULL if a registry entery does not
exist.
Actual result:
--------------
Fatal error: Uncaught exception 'com_exception' with message 'Source:
WshShell.RegRead
Description: Unable to open registry key
"HKEY_CURRENT_USER\Environment\TEMP11111" for reading.' in
f:\web\test.php:3 Stack trace: #0 {main} thrown in f:\web\test.php on
line 3
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29747&edit=1