php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33339 Apache2 crashes with $GLOBALS used in recursive function
Submitted: 2005-06-14 15:22 UTC Modified: 2010-12-20 11:55 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: webmaster at gleitgeb dot at Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.4 OS: Windows 2000 SP4
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: webmaster at gleitgeb dot at
New email:
PHP Version: OS:

 

 [2005-06-14 15:22 UTC] webmaster at gleitgeb dot at
Description:
------------
I tested on 2 Systems:
Both Windows 2000 Professional SP4
Apache 2.0.54
PHP 5.0.4

With the following code below Apache crashes reproducibly

Depending Apache-Errorlog-entrys:
[Mon Jun 13 23:32:42 2005] [notice] Apache/2.0.54 (Win32) DAV/2 PHP/5.0.5-dev mod_jk/1.2.8 configured -- resuming normal operations
[Mon Jun 13 23:32:42 2005] [notice] Server built: Apr 16 2005 14:25:31
[Mon Jun 13 23:32:42 2005] [notice] Parent: Created child process 4116
[Mon Jun 13 23:32:42 2005] [notice] Disabled use of AcceptEx() WinSock2 API
[Mon Jun 13 23:32:43 2005] [notice] Child 4116: Child process is running
[Mon Jun 13 23:32:43 2005] [notice] Child 4116: Acquired the start mutex.
[Mon Jun 13 23:32:43 2005] [notice] Child 4116: Starting 250 worker threads.
[Mon Jun 13 23:32:43 2005] [notice] Child 4116: Listening on port 80.
>>>>[Tue Jun 14 00:29:46 2005] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Tue Jun 14 00:29:47 2005] [notice] Apache/2.0.54 (Win32) DAV/2 PHP/5.0.5-dev mod_jk/1.2.8 configured -- resuming normal operations
[Tue Jun 14 00:29:47 2005] [notice] Server built: Apr 16 2005 14:25:31
[Tue Jun 14 00:29:47 2005] [notice] Parent: Created child process 4220
[Tue Jun 14 00:29:48 2005] [notice] Disabled use of AcceptEx() WinSock2 API
[Tue Jun 14 00:29:49 2005] [notice] Child 4220: Child process is running
[Tue Jun 14 00:29:49 2005] [notice] Child 4220: Acquired the start mutex.
[Tue Jun 14 00:29:49 2005] [notice] Child 4220: Starting 250 worker threads.
[Tue Jun 14 00:29:49 2005] [notice] Child 4220: Listening on port 80.

I have register_globals=On.
But otherwise nothing special.


;extension=php_bz2.dll
;extension=php_cpdf.dll
;extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_dbx.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_filepro.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_ifx.dll
;extension=php_iisfunc.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_java.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_mssql.dll
;extension=php_msql.dll
extension=php_mysql.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_oracle.dll
;extension=php_pdf.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
extension=php_sockets.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_w32api.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_yaz.dll
;extension=php_zip.dll

Reproduce code:
---------------
<?php
$GLOBAL['x'] =0;
function schreibe() {
print "
<table border=\"2\"><tr><td>blah";
if($GLOBAL['x'] < 10) { $GLOBAL['x']++;  schreibe(); }
print "
</td></tr></table>"; }

schreibe();
?>

Expected result:
----------------
Script should stop after some time

Actual result:
--------------
Apache2 crashes

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-14 19:20 UTC] webmaster at gleitgeb dot at
That doesn't help ... I already tried the latest snapshot yesterday.

And I only copied the source from a script of one member of my webserver.
I didn't change anything.

I tried again now.
Now I get following Errorlogentry:
[Tue Jun 14 19:18:48 2005] [notice] Parent: child process exited with status 1073807364 -- Restarting.

But it's still crashing.
 [2005-06-14 19:22 UTC] webmaster at gleitgeb dot at
Replacing $GLOBAL with $GLOBALS doesn't end with a crash of Apache2!!!
 [2005-06-15 09:47 UTC] tony2001@php.net
That's because with typo you end up with endless loop.
The very same result you'll get with this code: <?php function f() { $x=1; f(); } f(); ?>
 [2005-06-15 13:32 UTC] webmaster at gleitgeb dot at
Yes sure I know 
... but it isn't a good solution to let Apache crash to end a endless loop isn't it?

There must be a better solution to prevent such problems .. like Stack-overflow or something like that.
Or if the maximum-execution time is reached the loop ends ..

I cannot check every users scripts if they have endless loops in it.
 [2005-06-16 12:52 UTC] webmaster at gleitgeb dot at
Any ideas to solve this problem or a workaround?
 [2010-12-20 11:55 UTC] jani@php.net
-Package: Tidy +Package: Scripting Engine problem
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 03 12:01:30 2024 UTC