|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66418 Segmentation fault while header_register_callback
Submitted: 2014-01-05 15:30 UTC Modified: 2014-01-07 12:02 UTC
From: P dot Rehs at gmx dot net Assigned: krakjoe (profile)
Status: Closed Package: HTTP related
PHP Version: 5.5.7 OS: Linux
Private report: No CVE-ID: None
 [2014-01-05 15:30 UTC] P dot Rehs at gmx dot net
PHP 5.5.7 (cli) (built: Dec 11 2013 20:55:14) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies

Server version: Apache/2.2.25 (Unix)
Server built:   Jul 18 2013 19:05:23

I have a problem with register_shutdown_function and headers_list and header.
My script rewrites some headers when register_shutdown_function is called.
Sometimes the script just crashes with a segmentation fault.

Test script:
I have not been able to write a short example but it tracked the issue down to register_shutdown_fuction

Big Script:

Problem is in file src/modrewrite.php. If you comment out line 21 to 26 it works like expected

Actual result:
Program terminated with signal 11, Segmentation fault.
#0  0x00007f92753832cc in zend_call_function () from /etc/httpd/modules/
(gdb) backtrace
#0  0x00007f92753832cc in zend_call_function () from /etc/httpd/modules/
#1  0x00007f927533b619 in sapi_send_headers () from /etc/httpd/modules/
#2  0x00007f92752bb309 in php_header () from /etc/httpd/modules/
#3  0x00007f9275342f63 in ?? () from /etc/httpd/modules/
#4  0x00007f9275343ff5 in php_output_write () from /etc/httpd/modules/
#5  0x00007f9275347326 in php_output_end_all () from /etc/httpd/modules/
#6  0x00007f92753324e5 in php_request_shutdown () from /etc/httpd/modules/
#7  0x00007f92754432ef in ?? () from /etc/httpd/modules/
#8  0x00000000004375f0 in ap_run_handler ()
#9  0x00000000004379b9 in ap_invoke_handler ()
#10 0x0000000000443f38 in ap_process_request ()
#11 0x0000000000441580 in ?? ()
#12 0x000000000043da40 in ap_run_process_connection ()
#13 0x0000000000448a0f in ?? ()
#14 0x0000000000448e44 in ?? ()
#15 0x0000000000448ee6 in ?? ()
#16 0x0000000000449cc1 in ap_mpm_run ()
#17 0x00000000004239a6 in main ()


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-06 18:50 UTC] P dot Rehs at gmx dot net
-Summary: Segmentation fault while sending headers +Summary: Segmentation fault while header_register_callback
 [2014-01-06 18:50 UTC] P dot Rehs at gmx dot net
I tracked down the issue to header_register_callback
Everything works fine with register_shutdown_function but not when called from header_register_callback.
 [2014-01-07 12:02 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2014-01-07 12:02 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

This was reported previously and patched already.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 11:01:22 2020 UTC