php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41577 DOTNET is successful once per server run
Submitted: 2007-06-03 15:31 UTC Modified: 2014-08-12 09:56 UTC
Votes:20
Avg. Score:4.5 ± 1.1
Reproduced:19 of 19 (100.0%)
Same Version:2 (10.5%)
Same OS:8 (42.1%)
From: boen dot robot at gmail dot com Assigned: ab (profile)
Status: Closed Package: COM related
PHP Version: 5CVS-2007-06-03 (snap) OS: Windows XP Professional SP2
Private report: No CVE-ID: None
 [2007-06-03 15:31 UTC] boen dot robot at gmail dot com
Description:
------------
When I run any PHP file using the DOTNET class, The class is first run as it should (the sample from the documentation does ineed produce "Hello .Net"), but after a page refresh, or if a navigate away from the page and go back, the server crashes.

I have PHP installed locally as an Apache 2.2.4 module.

I tryed turning off my antivirus (NOD32 in case it's relevant), but that didn't helped either.

I have all .NET 1.1, .NET 2.0 and .NET 3.0 with all updates from Microsoft Update.

Reproduce code:
---------------
<?php
$stack = new DOTNET("mscorlib", "System.Collections.Stack") or die('not created');
die('created');
?>

Expected result:
----------------
The file should output "created" every time it's executed, unless perhaps I had an error in the constructor, in which case it should output "not created".

Actual result:
--------------
"created" is only outputted the first time. After that... A server crash with this in the error details:

szAppName : httpd.exe     szAppVer : 2.2.4.0     szModName : php5ts.dll     
szModVer : 5.2.4.4     offset : 000e622d

Patches

reinitialize-dotnet_domain-struct-member (last revision 2014-03-13 15:12 UTC by a dot kasparas at gmc dot lt)
stop_rshutdown_release (last revision 2013-02-19 05:02 UTC by ku at digitaldolphins dot jp)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-15 08:32 UTC] jani@php.net
Assigned to the maintainer.
 [2007-12-20 15:58 UTC] heathfrankel at internode dot on dot net
I have also exerienced this issue and it is likely to be a show stopper for a very important project for our company.  I have tried this on Win XP and Win 2003, I have used PHP5.2 from PHP.NET and from WAMPSERVER, I have used IIS and Apache.  It oocurs for my own .NET objects and for the standard PHP documentation example.  It is all the same.  Finally after much searching I have found this Bug Report, now I don't feel so alone but still in the learch.  A quick fix would be appreciated.
 [2007-12-20 16:52 UTC] heathfrankel at internode dot on dot net
Is this related http://support.microsoft.com/kb/837318?
 [2008-01-28 19:58 UTC] jthorpe at statestreet dot com
I am also experiencing this problem.

Here's the crash message...

Unhandled exception at 0x00ad736d in httpd.exe: 0xC0000005: Access violation reading location 0x00000000.

and the end of the call stack...

>	php5ts.dll!00ad736d() 	
 	ntdll.dll!7c91056d() 	
 	user32.dll!7e419951() 	
 	ntdll.dll!7c910833() 	
 	ntdll.dll!7c910833()
 [2008-06-03 16:32 UTC] sam at bitopia dot co dot uk
I had this problem, and finally managed to solve it by running php as cgi instead of an apache module, google for how to do it, but basically it's disabling the apache module, then adding three lines in the apache conf
 [2013-02-14 06:22 UTC] ku at digitaldolphins dot jp
I have this problem too.

It seems that the access to the released pointer may cause it.

line 233 in C:\php-sdk\php54dev\vc9\x86\php-5.4.11\ext\com_dotnet\com_dotnet.c 
---
hr = stuff->dotnet_domain->lpVtbl->CreateInstance(stuff->dotnet_domain, 
oleassembly_sys, oletype_sys, &unk);
---

stuff->dotnet_domain is released in both php_com_dotnet_rshutdown and 
php_com_dotnet_mshutdown.

However it would not be recovered for further requests.

Either rinit or com_dotnet_create_instance may need check for pointer access.

Thanks
 [2013-02-16 09:37 UTC] ku at digitaldolphins dot jp
Is it good idea to disable release action in rshutdown?

---
void php_com_dotnet_rshutdown(TSRMLS_D)
{
	struct dotnet_runtime_stuff *stuff = COMG(dotnet_runtime_stuff);
	
	if (stuff->dotnet_domain) {
	//	IDispatch_Release(stuff->dotnet_domain);
	//	stuff->dotnet_domain = NULL;
	}
}
---

My own php 5.4.11 build works well with this workaround.

Any possible side effects?

Thanks
 [2013-12-13 07:50 UTC] wez@php.net
-Status: Assigned +Status: Open -Assigned To: wez +Assigned To:
 [2014-03-13 15:20 UTC] a dot kasparas at gmc dot lt
In the present form DOTNET class is completely unuseable in FastCGI scenario,
as it crashes php-cgi.exe process on every second request. Both patches submitted to this bug solve crashing. Therefore, please apply any of them to master source.
 [2014-05-22 16:05 UTC] ab@php.net
-Assigned To: +Assigned To: ab
 [2014-07-08 08:47 UTC] ab@php.net
@a dot kasparas at gmc dot lt I saw your https://github.com/php/php-src/pull/681 to this ticket, feel free to attach it here. Also, could you please rebase it to 5.4 Gonna test and merge it then.

Thanks.
 [2014-08-12 09:56 UTC] ab@php.net
-Status: Assigned +Status: Closed
 [2014-08-12 09:56 UTC] ab@php.net
Merged in b3860f4224890b16f53aa86981a342f721293d11 and backported.

Thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 08:01:29 2024 UTC