php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50305 DOTNET Warning
Submitted: 2009-11-26 03:02 UTC Modified: 2011-01-14 08:40 UTC
Votes:6
Avg. Score:4.2 ± 0.7
Reproduced:5 of 5 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: noon at ms8 dot url dot com dot tw Assigned:
Status: Open Package: COM related
PHP Version: 5.3.1 OS: Windows Vista
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: 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)

Add a Patch

Pull Requests

Add a Pull Request

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?
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Nov 14 17:01:35 2019 UTC