php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29490 'Failed to instantiate .Net object' using PHP.NET docu example
Submitted: 2004-08-02 13:23 UTC Modified: 2004-08-08 21:11 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:0 (0.0%)
From: mike at ziebeck dot net Assigned:
Status: Closed Package: COM related
PHP Version: 5.0.0 OS: Windows 2000
Private report: No CVE-ID:
 [2004-08-02 13:23 UTC] mike at ziebeck dot net
Description:
------------
PHP.NET Api is not working.

While trying to instantiate .NET object as shown in the PHP.NET documentation example a fatal error occures.

Tested Config:
 Windows 2000 pro + MS.NET RTL 1.1 + PHP 5.0 final 
 XP pro + MS.NET SDK 1.1 + PHP 5.0Rc3 /5.0 final 
 both tested via php CLI using config file php.ini-dist 

also noticed by:
--------------------------------------------------------------
Subject: [PHP] Instantiate .NET Classes in PHP5?
From: "Matthias HALDIMANN" <matthias.haldimann(-at-)epfl.ch>
Id:<20040430084921.10316.qmail@pb1.pair.com>
Date: Fri, 30 Apr 2004 10:49:20 +0200

http://archive.netbsd.se/?list=php-general&a=2004-04&mid=190829 

Reproduce code:
---------------
<?php
  $stack = new DOTNET("mscorlib", "System.Collections.Stack");
  $stack->Push(".Net");
  $stack->Push("Hello ");
  echo $stack->Pop() . $stack->Pop();
?>

Expected result:
----------------
Hello.NET

Actual result:
--------------
PHP Fatal error:  Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object' in st_DotNet.php:2

Stack trace:
#0 {main}
  thrown in tst_DotNet.php on line 2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-02 20:04 UTC] wez@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

Please try the next PHP 5.1-dev (Unstable) snapshot dated after this report.
I don't anticipate this fixing the problem, but it should give a reason why the instantiation failed, and we can move on from there.

 [2004-08-02 20:56 UTC] mike at ziebeck dot net
same result using:
------------------
PHP 5.1.0-dev (cli) (built: Aug  2 2004 16:28:27)
Zend Engine v2.0.1-dev, Copyright (c) 1998-2004 Zend Zechnologies
 [2004-08-02 21:37 UTC] wez@php.net
Dated *after* this message.
 [2004-08-03 07:50 UTC] mike at ziebeck dot net
same result using:
------------------
PHP 5.1.0-dev (cli) (built: Aug  3 2004 04:21:03)
Zend Engine v2.0.1-dev, Copyright (c) 1998-2004 Zend Technologies
 [2004-08-03 11:46 UTC] wez@php.net
I've added even more verbosity; please try the next snapshot, which is due in about 45 minutes--it takes about that long to build, so this change might not quite make it into that snap.
If you try it and see no different error message, wait for the next snap after that.
 [2004-08-03 13:44 UTC] mike at ziebeck dot net
little more verbose output using:
---------------------------------
PHP 5.1.0-dev (cli) (built: Aug  3 2004 12:19:41)

Actual result:
--------------
Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [IDispatch_Invoke]' in tst_DotNet.php:2
Stack trace:
#0 {main}
  thrown in tst_DotNet.php on line 2
 [2004-08-03 14:42 UTC] wez@php.net
ok, I've added even more verbosity; please try the next snap in about 2 hours time.

 [2004-08-03 17:17 UTC] mike at ziebeck dot net
even more verbose output using:
-------------------------------
PHP 5.1.0-dev (cli) (built: Aug  3 2004 16:28:21)

Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [IDispatch_Invoke] Ausnahmefehler aufgetreten.
' in tst_DotNet.php:2
Stack trace:
#0 {main}
  thrown in tst_DotNet.php on line 2
 [2004-08-04 09:49 UTC] mike at ziebeck dot net
same result using:
------------------
PHP 5.1.0-dev (cli) (built: Aug  4 2004 08:29:44)
Zend Engine v2.0.1-dev, Copyright (c) 1998-2004 Zend Technologies
 [2004-08-04 13:44 UTC] wez@php.net
What is the english translation of that error message?
 [2004-08-04 13:56 UTC] mike at ziebeck dot net
Ausnahmefehler aufgetreten = exception error happened

sounds like:
 something went wrong, but i don't know what :(
 [2004-08-04 15:03 UTC] wez@php.net
:-(
Suffice to say that it does work here for me.
Is there anything else you can try to troubleshoot ?
Service packs/upgrades, permissions and so on.
Without more information, we can't find the cause of the problem.
 [2004-08-04 18:18 UTC] mike at ziebeck dot net
Software Setup:

Windows 2000 pro (german) clean install (Service Pack 4)
.NET: MS DotNET FrameWork RTL 1.1
USER: Administrator

unpack: php5-win32-200408040230.zip => c:\Programme\php\php5
copy:   c:\Programme\php\php5.php.ini-dist 
        c:\Programme\php\php5.php.ini
copy:   tst_DotNet.php c:\Programme\php\tst_DotNet.php 

>php -c c:\Programme\php\php5\php.ini -f tst_DotNet.php

Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [IDispatch_Invoke] Ausnahmefehler aufgetreten.' in c:\Programme\php\php5\tst_DotNet.php:2
Stack trace:
#0 {main}
  thrown in c:\Programme\php\php5\tst_DotNet.php on line 2

------------------------------------------------------------
No files (*.ini, *.dll)  have been (re)placed in windows system folders. Working directory: c:\Programme\php\php5
------------------------------------------------------------

Kind Regards
     mz.
 [2004-08-04 18:23 UTC] mike at ziebeck dot net
There's been a typo: 

c:\Programme\php\php5.php.ini
              is
c:\Programme\php\php5.ini

Sorry for that.
       mz.
 [2004-08-05 08:14 UTC] matthias dot haldimann at epfl dot ch
Though this might not help a lot, it might still be interesting to note that I continue to have the exact same problem, under

Windowx XP, English, SP1 + all available patches
with
PHP 5.1.0-dev, Snapshot Aug 5 2004 04:15:53 
and .NET Framework 1.1

Matthias
 [2004-08-05 09:25 UTC] mike at ziebeck dot net
I've additionaly tryed to get the example with:
PHP 5.1.0-dev (cli) (built: Aug  4 2004 08:29:44)
running on a development machine.

MS .NET Studio 2003 Enterprise Architect
MS .NET Frame Work SDK 1.1
MS Platform SDK February 2003

same results :(
 [2004-08-07 22:40 UTC] christian at wenz dot org
FWIW, I can reproduce it with


Windowx XP Pro, German, SP1 + all available patches
with
PHP 5.1.0-dev, current snapshot as CGI and .NET Framework 1.1
IIS 5.1


Windowx XP Pro, German, SP1 + all available patches
with
PHP 5.1.0-dev, current snapshot as CGI and .NET Framework 1.1
Apache 1.3.31


Windowx XP Home, German, SP1 + all available patches
with
PHP 5.1.0-dev, current snapshot as CGI and .NET Framework 1.0SP1
Apache 2.0.50


Windowx XP Pro, German, SP1 + all available patches
with
PHP 5.1.0-dev, current snapshot as CGI and .NET Framework 1.0
IIS 5.1


I'll try to test it on more systems tomorrow.
 [2004-08-08 01:03 UTC] wez@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Thanks to Michael Sisolak, this bug has been resolved.
Try the next snapshot.
 [2004-08-08 17:05 UTC] christian at wenz dot org
I still get the error with http://snaps.php.net/win32/php5-win32-200408081430.zip
"mike at ziebeck dot net" and "matthias dot haldimann at epfl dot ch", can you reproduce that?
 [2004-08-08 21:11 UTC] mike at ziebeck dot net
Well DONE, Michael !!
=====================

Works fine now using:
php5-win32-200408081430.zip
PHP 5.1.0-dev (cli) (built: Aug  8 2004 16:31:06)
Zend Engine v2.0.1-dev, Copyright (c) 1998-2004 Zend Technologies

>php5 -f tst_DotNet.php
Hello .Net

Windows XP pro (no sevice packs, no patches)
MS .NET SDK 1.1
logged on as 'Hauptbenutzer'==MainUser

Best Regards
     mz.
 [2004-08-09 08:20 UTC] christian at wenz dot org
alas, after a reboot (!) it works with both 5.0.1-dev and 5.1.0-dev. It even works under XP SP2 ;-). Great job, guys!
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 01:01:59 2014 UTC