php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: P dot Rehs at gmx dot net
New email:
PHP Version: OS:

 

 [2014-01-05 15:30 UTC] P dot Rehs at gmx dot net
Description:
------------
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:
https://github.com/Phhere/webSPELL-4.2.3/tree/modRewrite

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/libphp5.so
(gdb) backtrace
#0  0x00007f92753832cc in zend_call_function () from /etc/httpd/modules/libphp5.so
#1  0x00007f927533b619 in sapi_send_headers () from /etc/httpd/modules/libphp5.so
#2  0x00007f92752bb309 in php_header () from /etc/httpd/modules/libphp5.so
#3  0x00007f9275342f63 in ?? () from /etc/httpd/modules/libphp5.so
#4  0x00007f9275343ff5 in php_output_write () from /etc/httpd/modules/libphp5.so
#5  0x00007f9275347326 in php_output_end_all () from /etc/httpd/modules/libphp5.so
#6  0x00007f92753324e5 in php_request_shutdown () from /etc/httpd/modules/libphp5.so
#7  0x00007f92754432ef in ?? () from /etc/httpd/modules/libphp5.so
#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 ()

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] krakjoe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2014-01-07 12:02 UTC] krakjoe@php.net
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
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

This was reported previously and patched already.

https://github.com/php/php-src/commit/3c3ff434329d2f505b00a79bacfdef95ca96f0d2
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 04:01:28 2024 UTC