php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16323 php_OLECHAR_to_char() error in IIS
Submitted: 2002-03-27 19:40 UTC Modified: 2002-04-06 19:15 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: preston dot bannister at cox dot net Assigned:
Status: Closed Package: COM related
PHP Version: 4.1.2 OS: Windows 2000 Professional
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: preston dot bannister at cox dot net
New email:
PHP Version: OS:

 

 [2002-03-27 19:40 UTC] preston dot bannister at cox dot net
The following example PHP script works fine when run from the command line, but fails when run via IIS.

<?php
$wsh = @new COM('WScript.Shell') or die("Cannot create instance of Windows Scripting Host!");
$key = 'HKLM\foo';
$v = $wsh->RegRead($key);
echo "<br> Got $key = $v\n";
$v = $v + 1;
$wsh->RegWrite($key,$v);
echo "<br> Set $key to $v\n";
?>

The error returned references the line containing RegWrite.
----
Got HKLM\foo = 2 
Warning: Error in php_OLECHAR_to_char() in c:\asg\webmanager\test\x4.php on line 7

Warning: Error in php_OLECHAR_to_char() in c:\asg\webmanager\test\x4.php on line 7

Warning: Invoke() failed: Exception occurred. Source: Description: in c:\asg\webmanager\test\x4.php on line 7

Set HKLM\foo to 3 
----

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-29 04:52 UTC] Vladimir dot Michl at hlubocky dot del dot cz
I found the same problem with php 4.1.1, if OLE Automation object return empty string.

After some testing a have this result:

OLE Automation server return Variant with type 0x08 - OLE Str. To php_OLECHAR_to_char() (in conversion.c)
as unicode_str arrive probably NULL, because WideCharToMultiByte return 0 and
in my simulations WideCharToMultiByte return 0 if unicode_str is NULL.

I thing that, if unicode_str is NULL, php_OLECHAR_to_char()
must convert it to empty string, without any warning.
 [2002-04-06 19:15 UTC] phanto@php.net
this should be fixed in the upcomming 4.2.0 version. try one of the release candidates.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 19:01:37 2025 UTC