php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29747 Fatal error on COM registry read.
Submitted: 2004-08-19 02:22 UTC Modified: 2004-09-10 13:51 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: radek at pinkbike dot com Assigned:
Status: Not a bug Package: COM related
PHP Version: 5CVS-2004-08-19 (dev) OS: Windows XP
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: radek at pinkbike dot com
New email:
PHP Version: OS:

 

 [2004-08-19 02:22 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-10 13:51 UTC] wez@php.net
Use exception handling.
Not a PHP bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC