php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #50305 DOTNET Warning
Submitted: 2009-11-26 03:02 UTC Modified: 2020-06-16 16:52 UTC
Votes:7
Avg. Score:3.6 ± 1.3
Reproduced:4 of 5 (80.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: noon at ms8 dot url dot com dot tw Assigned: cmb (profile)
Status: Closed Package: COM related
PHP Version: 5.3.1 OS: Windows Vista
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: noon at ms8 dot url dot com dot tw
New email:
PHP Version: OS:

 

 [2009-11-26 03:02 UTC] noon at ms8 dot url dot com dot tw
Description:
------------
runtime: .Net Framework 3.5


I need to add a button to a windows form. 
When I run the script "$x->Control", it generates warning message as follows:  

Warning: main(): variant->zval: conversion from 0xd ret=-1 in C:\Windows\Microsoft.NET\Framework\v3.5\ofg.php

Reproduce code:
---------------
<?php
$x = new DOTNET('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', 'System.Windows.Forms.Form', CP_UTF8);
$y = $x->Controls;
$x->showDialog();
?>

Expected result:
----------------
$y = $x->Controls;

^^^^ $y must be Object

Actual result:
--------------
Warning: main(): variant->zval: conversion from 0xd ret=-1 in C:\Windows\Microsoft.NET\Framework\v3.5\ofg.php

Patches

accept-LPUNKNOWN (last revision 2013-02-20 14:36 UTC by user at kkdf2 dot sakura dot ne dot jp)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-13 12:51 UTC] t33th4n at gmail dot com
Description:
------------
Error is valid.
Trying to create a dialog with .NET, but basic functions are failing to proceed.

Reproduce code:
---------------
		$form1 = new DOTNET("System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", 'System.Windows.Forms.Form');
		$button1 = new DOTNET("System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", 'System.Windows.Forms.Button');
		$button1->Text = "Press me!";
		$form1->Controls->Add($button1);
		$form1->Show();

Expected result:
----------------
Add a button control to the form.

Actual result:
--------------
Warning: main(): variant->zval: conversion from 0xd ret=-1 in D:\xampplite\php\form1.php on line 10
PHP Fatal error:  Call to a member function Add() on a non-object in D:\xampplite\php\form1.php on line 10
 [2011-01-14 08:40 UTC] kalle@php.net
This means that the variant conversion (as the error says) failed, 0xD is the variant type value of the object being converted. 0xD evaluates to 13 which is VT_UNKNOWN, an object that implements the IUnknown interface.

I however doubt theres anyone who will look at fixing this anytime soon as COM/dotnet needs an active maintainer
 [2013-02-20 14:39 UTC] user at kkdf2 dot sakura dot ne dot jp
I've posted a patch.

I'm not sure whether it works well or not.
 [2013-10-18 02:41 UTC] eric at pby dot com
I'm not proficient enough in C to even compile PHP.  Until this bug is fixed in a stable release, is it possible to define a PHP class that mirrors the COM class and cast the object into that class so that I can access its functions and properties?
 [2020-02-07 10:48 UTC] cmb@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: cmb
 [2020-02-07 10:48 UTC] cmb@php.net
That COM object is supposed to implement IDispatch, but apparently
it does not; converting it to a PHP Variant (like in the attached
patch accept-LPUNKNOWN) would not solve the problem (while it
makes the OP's test script work, it still leaves a practically
unusable Controls object, because it only postpones the problem).
 [2020-06-16 16:52 UTC] cmb@php.net
-Type: Bug +Type: Documentation Problem
 [2020-06-16 16:52 UTC] cmb@php.net
Doesn't make sense to wait for a magic fix – changing to doc
issue.
 [2020-06-18 08:44 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=001013aeb83751e8bbbf91d45070d3b751c4dfa0
Log: Fix #50305: DOTNET Warning
 [2020-06-18 08:44 UTC] phpdocbot@php.net
-Status: Assigned +Status: Closed
 [2020-06-19 19:40 UTC] phpdocbot@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=59439166c01d6cd817576359897769a41e42436e
Log: Fix #50305: DOTNET Warning
 [2020-12-30 11:59 UTC] nikic@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=8044c1335ec74f9871e6b380bb198bbcfe4b4ec6
Log: Fix #50305: DOTNET Warning
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 06:01:29 2024 UTC