php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51205 Fatal error: com_exception: The parameter is incorrect
Submitted: 2010-03-04 22:31 UTC Modified: 2013-02-18 00:34 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: zelnaga at gmail dot com Assigned:
Status: No Feedback Package: COM related
PHP Version: 5.3.1 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zelnaga at gmail dot com
New email:
PHP Version: OS:

 

 [2010-03-04 22:31 UTC] zelnaga at gmail dot com
Description:
------------
Hi,

I need to use RNGCryptoServiceProvider in PHP.

I have tried:

$rng = new DOTNET("mscorlib",
"System.Security.Cryptography.RNGCryptoServiceProvider");
$arr = array(0);
$v = new VARIANT($arr,VT_ARRAY);
$rng->GetBytes($v);
unset($rng);

The component loads fine.

But I got this error: Fatal error: Uncaught exception 'com_exception'
with message 'Error [0x80070057] The parameter is incorrect.

Any ideas?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-15 15:27 UTC] kalle@php.net
-Status: Open +Status: Feedback
 [2010-03-15 15:27 UTC] kalle@php.net
In what line does this happen?
 [2010-03-26 18:47 UTC] zelnaga at gmail dot com
-Status: Feedback +Status: Open
 [2010-03-26 18:47 UTC] zelnaga at gmail dot com
the $rng->GetBytes($v); line.
 [2010-04-12 02:20 UTC] kalle@php.net
-Status: Open +Status: Feedback
 [2010-04-12 02:20 UTC] kalle@php.net
You cannot use VT_ARRAY as the only type sent to VARIANT's ctor. VT_ARRAY is a flag that needs to be OR'd with another type, e.g.:

$variant = new VARIANT($..., VT_UI1 | VT_ARRAY);
 [2010-06-24 10:57 UTC] T-K-N at gmail dot com
I too was using DOTNET when I got this error.

After trying the suggested solution using this code:
$arr = array(1);
$var = new VARIANT($arr, VT_UI1|VT_ARRAY);

I got this error:
Variant type conversion failed: Type mismatch.
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 02:01:30 2024 UTC