Bug #53140 [Com]: PHP-CGI (FastCGI IIS) crashes when creating DOTNET instance every second time

2013-01-08 Thread johnphayes at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=53140&edit=1

 ID: 53140
 Comment by: johnphayes at gmail dot com
 Reported by:jeyb88 at gmail dot com
 Summary:PHP-CGI (FastCGI IIS) crashes when creating DOTNET
 instance every second time
 Status: Open
 Type:   Bug
 Package:COM related
 Operating System:   XP, Vista, Win 7,Win Server 2008
 PHP Version:5.3.3
 Block user comment: N
 Private report: N

 New Comment:

You may be able to fix this issue by recompiling PHP with the 

void php_com_dotnet_mshutdown()

defined in /ext/com_dotnet/com_dotnet.c. IIRC the problem was that that 
function 
was removed in this revision: 

http://svn.php.net/viewvc/php/php-src/trunk/ext/com_dotnet/com_dotnet.c?
r1=137794&r2=146718. 

So if you can download the latest source, put that function back into 
com_dotnet.c, and recompile you should be good to go.


Previous Comments:

[2013-01-08 09:35:22] xandra_18ro at yahoo dot com

Is there a hotfix for this problem? Or a workaround perhaps.
thanks!


[2012-03-26 16:18:30] andrew dot king at simail dot co dot uk

I can confirm that this problem also exists on PHP 5.3.2 on Windows Server 2003 
32-bit with IIS running FastCGI. Problem also occurs on WAMP server, Windows 7 
64-bit running PHP 5.3.8, Apache 2.2.21 with PHP loaded as a module, not CGI.


[2011-08-24 17:02:08] johnphayes at gmail dot com

Here is the Application Event log entry in Windows Server 2003 when this crash 
occurs in my test case above:

Source: .NET Runtime 2.0 Error

Description:
Faulting application httpd.exe, version 2.2.19.0, stamp 4dd6eda8, faulting 
module 
php5ts.dll, version 5.2.17.17, stamp 4d25fb49, debug? 0, fault address 
0x000ea66d.

This source is a little odd, because I have .NET 4.0 Runtime installed. Note 
that although I have PHP 5.2.17 installed at the moment, I have experienced 
this 
with 5.3 as well.


[2011-08-24 16:23:21] johnphayes at gmail dot com

Can this bug's summary be edited to remove "(FastCGI IIS)?" My comment above 
shows 
that it can be reproduced under Apache as an Apache handler as well.


[2011-08-24 16:18:58] johnphayes at gmail dot com

This error only appears to happen when the offending code is run from a web 
server. If I run the offending code directly from the CLI, php never crashes. 
If 
I run the same code through Apache (via a cURL request), Apache crashes every 
other time. My configuration is:

* Windows Server 2003 R2
* Apache 2.2
* PHP 5.3 configured as an Apache handler, not under FastCGI (see 
http://www.php.net/manual/en/install.windows.apache2.php)
* The following 2 files:

--



--

http://localhost/testCrash.php';

$client = curl_init();
curl_setopt_array($client, array(
CURLOPT_FRESH_CONNECT => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_URL => $endPoint
));
$response = curl_exec($client);
curl_close($client);
var_dump($response);

echo 'done';
?>

--

Use case #1 - run locally, we get no crash:
Steps:
1. Open command prompt
2. Execute:
   php.exe testCrash.php
3. Observe that we get the expected resulting output: 
   success
4. Repeat step 2. Expected result will always be obtained.

Use case #2 - run through the web server, we get the crash:
Steps:
1. Open command prompt
2. Execute:
   php.exe testCrashClient.php
3. Observe that we get the expected resulting output:
   string(7) "success"
   done
4. Repeat step 2.
5. Now observe that we get an error:
   bool(false)
   done
6. Repeat step 2.
7. Expected successful output is obtained again.

Repeating step 2 will cause the crash every other time. When the crash occurs, 
apache's error log gets:

--
[Wed Aug 24 12:13:25 2011] [notice] Parent: child process exited with status 0 -
- Restarting.
[Wed Aug 24 12:13:25 2011] [notice] Apache/2.2.19 (Win32) PHP/5.2.17 configured 
-- resuming normal operations
[Wed Aug 24 12:13:25 2011] [notice] Server built: May 20 2011 17:39:35
[Wed Aug 24 12:13:25 2011] [notice] Parent: Created child process 2624
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Child process is running
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Acquired the start mutex.
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Starting 64 worker threads.
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Starting thread to listen on 
port 80.
--




The remainder of the comments for this report ar

Bug #53140 [Com]: PHP-CGI (FastCGI IIS) crashes when creating DOTNET instance every second time

2011-08-24 Thread johnphayes at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=53140&edit=1

 ID: 53140
 Comment by: johnphayes at gmail dot com
 Reported by:jeyb88 at gmail dot com
 Summary:PHP-CGI (FastCGI IIS) crashes when creating DOTNET
 instance every second time
 Status: Open
 Type:   Bug
 Package:COM related
 Operating System:   XP, Vista, Win 7,Win Server 2008
 PHP Version:5.3.3
 Block user comment: N
 Private report: N

 New Comment:

Here is the Application Event log entry in Windows Server 2003 when this crash 
occurs in my test case above:

Source: .NET Runtime 2.0 Error

Description:
Faulting application httpd.exe, version 2.2.19.0, stamp 4dd6eda8, faulting 
module 
php5ts.dll, version 5.2.17.17, stamp 4d25fb49, debug? 0, fault address 
0x000ea66d.

This source is a little odd, because I have .NET 4.0 Runtime installed. Note 
that although I have PHP 5.2.17 installed at the moment, I have experienced 
this 
with 5.3 as well.


Previous Comments:

[2011-08-24 16:23:21] johnphayes at gmail dot com

Can this bug's summary be edited to remove "(FastCGI IIS)?" My comment above 
shows 
that it can be reproduced under Apache as an Apache handler as well.


[2011-08-24 16:18:58] johnphayes at gmail dot com

This error only appears to happen when the offending code is run from a web 
server. If I run the offending code directly from the CLI, php never crashes. 
If 
I run the same code through Apache (via a cURL request), Apache crashes every 
other time. My configuration is:

* Windows Server 2003 R2
* Apache 2.2
* PHP 5.3 configured as an Apache handler, not under FastCGI (see 
http://www.php.net/manual/en/install.windows.apache2.php)
* The following 2 files:

--



--

http://localhost/testCrash.php';

$client = curl_init();
curl_setopt_array($client, array(
CURLOPT_FRESH_CONNECT => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_URL => $endPoint
));
$response = curl_exec($client);
curl_close($client);
var_dump($response);

echo 'done';
?>

--

Use case #1 - run locally, we get no crash:
Steps:
1. Open command prompt
2. Execute:
   php.exe testCrash.php
3. Observe that we get the expected resulting output: 
   success
4. Repeat step 2. Expected result will always be obtained.

Use case #2 - run through the web server, we get the crash:
Steps:
1. Open command prompt
2. Execute:
   php.exe testCrashClient.php
3. Observe that we get the expected resulting output:
   string(7) "success"
   done
4. Repeat step 2.
5. Now observe that we get an error:
   bool(false)
   done
6. Repeat step 2.
7. Expected successful output is obtained again.

Repeating step 2 will cause the crash every other time. When the crash occurs, 
apache's error log gets:

--
[Wed Aug 24 12:13:25 2011] [notice] Parent: child process exited with status 0 -
- Restarting.
[Wed Aug 24 12:13:25 2011] [notice] Apache/2.2.19 (Win32) PHP/5.2.17 configured 
-- resuming normal operations
[Wed Aug 24 12:13:25 2011] [notice] Server built: May 20 2011 17:39:35
[Wed Aug 24 12:13:25 2011] [notice] Parent: Created child process 2624
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Child process is running
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Acquired the start mutex.
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Starting 64 worker threads.
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Starting thread to listen on 
port 80.
--


[2010-11-16 23:40:13] davidphp at limegreensocks dot com

It appears this behavior was intentionally introduced by WEZ back in 2003.  

http://svn.php.net/viewvc/php/php-src/trunk/ext/com_dotnet/com_dotnet.c?r1=137794&r2=146718

I don't know what problem he was trying to fix back then, so I'm not sure of 
the implications of adding these two lines back.  But if you are using fastcgi, 
then jeyb88 is absolutely correct: this will crash every other time the code is 
run.  

My repro is even simpler than jeyb88's.  I don't even have to call any methods 
on the .net object.  I have a 1 line php file that calls the "new" against my 
.net class:

 

The constructor for my .net class is empty:

[ComVisible(true),
ClassInterface(ClassInterfaceType.None),
Guid("53C74B01-EC09-45a4-A741-42727858B2A1")]
public class Impersonation
{
public Impersonation()
{
}
// more code follows

When I first browse to the page, it (correctly) shows nothing.  Then I hit 
refresh, and I get the "FastCGI process exited unexpectedly" 0xc005.  If I 
hit refresh again, the page again (correctly) s

Bug #53140 [Com]: PHP-CGI (FastCGI IIS) crashes when creating DOTNET instance every second time

2011-08-24 Thread johnphayes at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=53140&edit=1

 ID: 53140
 Comment by: johnphayes at gmail dot com
 Reported by:jeyb88 at gmail dot com
 Summary:PHP-CGI (FastCGI IIS) crashes when creating DOTNET
 instance every second time
 Status: Open
 Type:   Bug
 Package:COM related
 Operating System:   XP, Vista, Win 7,Win Server 2008
 PHP Version:5.3.3
 Block user comment: N
 Private report: N

 New Comment:

Can this bug's summary be edited to remove "(FastCGI IIS)?" My comment above 
shows 
that it can be reproduced under Apache as an Apache handler as well.


Previous Comments:

[2011-08-24 16:18:58] johnphayes at gmail dot com

This error only appears to happen when the offending code is run from a web 
server. If I run the offending code directly from the CLI, php never crashes. 
If 
I run the same code through Apache (via a cURL request), Apache crashes every 
other time. My configuration is:

* Windows Server 2003 R2
* Apache 2.2
* PHP 5.3 configured as an Apache handler, not under FastCGI (see 
http://www.php.net/manual/en/install.windows.apache2.php)
* The following 2 files:

--



--

http://localhost/testCrash.php';

$client = curl_init();
curl_setopt_array($client, array(
CURLOPT_FRESH_CONNECT => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_URL => $endPoint
));
$response = curl_exec($client);
curl_close($client);
var_dump($response);

echo 'done';
?>

--

Use case #1 - run locally, we get no crash:
Steps:
1. Open command prompt
2. Execute:
   php.exe testCrash.php
3. Observe that we get the expected resulting output: 
   success
4. Repeat step 2. Expected result will always be obtained.

Use case #2 - run through the web server, we get the crash:
Steps:
1. Open command prompt
2. Execute:
   php.exe testCrashClient.php
3. Observe that we get the expected resulting output:
   string(7) "success"
   done
4. Repeat step 2.
5. Now observe that we get an error:
   bool(false)
   done
6. Repeat step 2.
7. Expected successful output is obtained again.

Repeating step 2 will cause the crash every other time. When the crash occurs, 
apache's error log gets:

--
[Wed Aug 24 12:13:25 2011] [notice] Parent: child process exited with status 0 -
- Restarting.
[Wed Aug 24 12:13:25 2011] [notice] Apache/2.2.19 (Win32) PHP/5.2.17 configured 
-- resuming normal operations
[Wed Aug 24 12:13:25 2011] [notice] Server built: May 20 2011 17:39:35
[Wed Aug 24 12:13:25 2011] [notice] Parent: Created child process 2624
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Child process is running
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Acquired the start mutex.
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Starting 64 worker threads.
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Starting thread to listen on 
port 80.
--


[2010-11-16 23:40:13] davidphp at limegreensocks dot com

It appears this behavior was intentionally introduced by WEZ back in 2003.  

http://svn.php.net/viewvc/php/php-src/trunk/ext/com_dotnet/com_dotnet.c?r1=137794&r2=146718

I don't know what problem he was trying to fix back then, so I'm not sure of 
the implications of adding these two lines back.  But if you are using fastcgi, 
then jeyb88 is absolutely correct: this will crash every other time the code is 
run.  

My repro is even simpler than jeyb88's.  I don't even have to call any methods 
on the .net object.  I have a 1 line php file that calls the "new" against my 
.net class:

 

The constructor for my .net class is empty:

[ComVisible(true),
ClassInterface(ClassInterfaceType.None),
Guid("53C74B01-EC09-45a4-A741-42727858B2A1")]
public class Impersonation
{
public Impersonation()
{
}
// more code follows

When I first browse to the page, it (correctly) shows nothing.  Then I hit 
refresh, and I get the "FastCGI process exited unexpectedly" 0xc005.  If I 
hit refresh again, the page again (correctly) shows nothing, next time, fastcgi 
AVs again.

I am using php 5.3.3, Windows Server 2003, and I have tried both .Net 2.0 and 
.Net 3.5.

The pattern here is easily reproducible, causes an unrecoverable access 
violation, and there is no workaround.  A fix here would be greatly appreciated.


[2010-10-22 15:59:15] jeyb88 at gmail dot com

Description:

The php-cgi.exe will crash after every second refresh when I make an instance 
of the DOTNET class. The Website is hostet via IIS 7 and PHP is configured as 
FastCGI module. When I confi

Bug #53140 [Com]: PHP-CGI (FastCGI IIS) crashes when creating DOTNET instance every second time

2011-08-24 Thread johnphayes at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=53140&edit=1

 ID: 53140
 Comment by: johnphayes at gmail dot com
 Reported by:jeyb88 at gmail dot com
 Summary:PHP-CGI (FastCGI IIS) crashes when creating DOTNET
 instance every second time
 Status: Open
 Type:   Bug
 Package:COM related
 Operating System:   XP, Vista, Win 7,Win Server 2008
 PHP Version:5.3.3
 Block user comment: N
 Private report: N

 New Comment:

This error only appears to happen when the offending code is run from a web 
server. If I run the offending code directly from the CLI, php never crashes. 
If 
I run the same code through Apache (via a cURL request), Apache crashes every 
other time. My configuration is:

* Windows Server 2003 R2
* Apache 2.2
* PHP 5.3 configured as an Apache handler, not under FastCGI (see 
http://www.php.net/manual/en/install.windows.apache2.php)
* The following 2 files:

--



--

http://localhost/testCrash.php';

$client = curl_init();
curl_setopt_array($client, array(
CURLOPT_FRESH_CONNECT => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_URL => $endPoint
));
$response = curl_exec($client);
curl_close($client);
var_dump($response);

echo 'done';
?>

--

Use case #1 - run locally, we get no crash:
Steps:
1. Open command prompt
2. Execute:
   php.exe testCrash.php
3. Observe that we get the expected resulting output: 
   success
4. Repeat step 2. Expected result will always be obtained.

Use case #2 - run through the web server, we get the crash:
Steps:
1. Open command prompt
2. Execute:
   php.exe testCrashClient.php
3. Observe that we get the expected resulting output:
   string(7) "success"
   done
4. Repeat step 2.
5. Now observe that we get an error:
   bool(false)
   done
6. Repeat step 2.
7. Expected successful output is obtained again.

Repeating step 2 will cause the crash every other time. When the crash occurs, 
apache's error log gets:

--
[Wed Aug 24 12:13:25 2011] [notice] Parent: child process exited with status 0 -
- Restarting.
[Wed Aug 24 12:13:25 2011] [notice] Apache/2.2.19 (Win32) PHP/5.2.17 configured 
-- resuming normal operations
[Wed Aug 24 12:13:25 2011] [notice] Server built: May 20 2011 17:39:35
[Wed Aug 24 12:13:25 2011] [notice] Parent: Created child process 2624
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Child process is running
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Acquired the start mutex.
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Starting 64 worker threads.
[Wed Aug 24 12:13:26 2011] [notice] Child 2624: Starting thread to listen on 
port 80.
--


Previous Comments:

[2010-11-16 23:40:13] davidphp at limegreensocks dot com

It appears this behavior was intentionally introduced by WEZ back in 2003.  

http://svn.php.net/viewvc/php/php-src/trunk/ext/com_dotnet/com_dotnet.c?r1=137794&r2=146718

I don't know what problem he was trying to fix back then, so I'm not sure of 
the implications of adding these two lines back.  But if you are using fastcgi, 
then jeyb88 is absolutely correct: this will crash every other time the code is 
run.  

My repro is even simpler than jeyb88's.  I don't even have to call any methods 
on the .net object.  I have a 1 line php file that calls the "new" against my 
.net class:

 

The constructor for my .net class is empty:

[ComVisible(true),
ClassInterface(ClassInterfaceType.None),
Guid("53C74B01-EC09-45a4-A741-42727858B2A1")]
public class Impersonation
{
public Impersonation()
{
}
// more code follows

When I first browse to the page, it (correctly) shows nothing.  Then I hit 
refresh, and I get the "FastCGI process exited unexpectedly" 0xc005.  If I 
hit refresh again, the page again (correctly) shows nothing, next time, fastcgi 
AVs again.

I am using php 5.3.3, Windows Server 2003, and I have tried both .Net 2.0 and 
.Net 3.5.

The pattern here is easily reproducible, causes an unrecoverable access 
violation, and there is no workaround.  A fix here would be greatly appreciated.


[2010-10-22 15:59:15] jeyb88 at gmail dot com

Description:

The php-cgi.exe will crash after every second refresh when I make an instance 
of the DOTNET class. The Website is hostet via IIS 7 and PHP is configured as 
FastCGI module. When I configure PHP on IIS as CGI module everything works 
fine, but I can not do without FastCGI. I have made a change in the 
com_dotnet.c file in function php_com_dotnet_rshutdown. The variable called 
stuff from type dotnet_runtime_stuff will not be released like in the function 
php_com_dotnet_msh

#49778 [Com]: DateInterval::format("%a") is always zero

2010-02-22 Thread johnphayes at gmail dot com
 ID:   49778
 Comment by:   johnphayes at gmail dot com
 Reported By:  jenwelsh at yahoo dot com
 Status:   Assigned
 Bug Type: Date/time related
 Operating System: Solaris 10
 PHP Version:  5.3.0
 Assigned To:  derick
 New Comment:

It probably should have a different bug for the Windows "6015" bug.
Just 
noting that this is what I'm seeing as well, not the original bug 
description.


Previous Comments:


[2010-01-26 17:51:02] hellbringer at gmail dot com

$d1 = new DateTime('2010-01-01');
$d2 = new DateTime('2010-01-26');
$diff = $d1->diff($d2);


echo phpversion();
// 5.3.1

echo $_SERVER['SERVER_SOFTWARE'];
// Apache/2.2.11 (Win32) PHP/5.3.1

echo $diff->format('%a');
// 6015

echo $diff->days;
// 6015

print_r($diff);
// DateInterval Object
// (
// [y] => 0
// [m] => 0
// [d] => 25
// [h] => 0
// [i] => 0
// [s] => 0
// [invert] => 0
// [days] => 6015
// )



[2009-11-17 19:23:01] awinningidea at gmail dot com

PHP 5.3 on windows, DateInterval::format('%a') gives 6015 for all
dates.

Example
===

$d1 = new DateTime('1/1/2009');
$d2 = new DateTime('1/5/2009');
$diff = $d1->diff($d2);
var_dump($diff->format('%a'));

Output
---
string '6015' (length=4)



[2009-10-05 18:49:57] der...@php.net

It's a bug, it should set this value really.



[2009-10-05 16:31:59] sjo...@php.net

Derick, how would you solve this?



[2009-10-05 16:29:44] sjo...@php.net

Thank you for your bug report.

Days is indeed not set when creating a DateInterval using the
constructor. A complication with this is that it is impossible to
determine the number of days when months or years are specified, since
these vary in length. It is possible to fill in the days field in some
cases and leave it 0 in others. In any case, it should be documented
that the days field is not always available.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/49778

-- 
Edit this bug report at http://bugs.php.net/?id=49778&edit=1