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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
6 - 3 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Tue Apr 16 16:01:28 2024 UTC