php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66375 Embedded Server segfault with header_register_callback
Submitted: 2013-12-31 11:45 UTC Modified: 2014-01-01 12:59 UTC
From: gmblar+php at gmail dot com Assigned: krakjoe (profile)
Status: Closed Package: *General Issues
PHP Version: 5.5.7 OS: MacOSX 10.9.1
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gmblar+php at gmail dot com
New email:
PHP Version: OS:

 

 [2013-12-31 11:45 UTC] gmblar+php at gmail dot com
Description:
------------
Embedded server segfault when callback for header_register_callback is a method.

1. Create script.
2. Start embedded server with php -S 0.0.0.0:8080.
3. First curl request curl http://localhost:8080/foo succeed.
4. Second curl request (only when path differs!) curl http://localhost:8080/foobar fails.


Test script:
---------------
<?php

class Foo {

    public function __construct() {
        header_register_callback(array($this, 'headerCallback'));
    }

    public function headerCallback() {
        
    }

}
$foo = new Foo();

Expected result:
----------------
PHP 5.5.7 Development Server started at Tue Dec 31 12:40:41 2013
Listening on http://0.0.0.0:8080
Document root is /Users/Username/Sites/Projectname/Public
Press Ctrl-C to quit.
[Tue Dec 31 12:41:27 2013] 127.0.0.1:54151 [200]: /foo
[Tue Dec 31 12:41:27 2013] 127.0.0.1:54154 [200]: /foobar


Actual result:
--------------
PHP 5.5.7 Development Server started at Tue Dec 31 12:39:09 2013
Listening on http://0.0.0.0:8080
Document root is /Users/Username/Sites/Projectname/Public
Press Ctrl-C to quit.
[Tue Dec 31 12:40:39 2013] 127.0.0.1:54136 [200]: /foo
[Tue Dec 31 12:40:41 2013] 127.0.0.1:54139 [200]: /foobar
Segmentation fault: 11


Patches

register_header_callback_segfault.patch (last revision 2013-12-31 19:16 UTC by krakjoe@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-31 19:16 UTC] krakjoe@php.net
The following patch has been added/updated:

Patch Name: register_header_callback_segfault.patch
Revision:   1388517390
URL:        https://bugs.php.net/patch-display.php?bug=66375&patch=register_header_callback_segfault.patch&revision=1388517390
 [2013-12-31 19:19 UTC] krakjoe@php.net
-Status: Open +Status: Verified
 [2014-01-01 12:59 UTC] krakjoe@php.net
-Assigned To: +Assigned To: krakjoe
 [2014-01-01 13:02 UTC] krakjoe@php.net
Automatic comment on behalf of joe.watkins@live.co.uk
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3c3ff434329d2f505b00a79bacfdef95ca96f0d2
Log: fix #66375 bad logic in sapi header callback routine
 [2014-01-01 13:02 UTC] krakjoe@php.net
-Status: Verified +Status: Closed
 [2014-01-02 09:35 UTC] ab@php.net
Automatic comment on behalf of joe.watkins@live.co.uk
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3c3ff434329d2f505b00a79bacfdef95ca96f0d2
Log: fix #66375 bad logic in sapi header callback routine
 [2014-10-07 23:16 UTC] stas@php.net
Automatic comment on behalf of joe.watkins@live.co.uk
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=3c3ff434329d2f505b00a79bacfdef95ca96f0d2
Log: fix #66375 bad logic in sapi header callback routine
 [2014-10-07 23:27 UTC] stas@php.net
Automatic comment on behalf of joe.watkins@live.co.uk
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=3c3ff434329d2f505b00a79bacfdef95ca96f0d2
Log: fix #66375 bad logic in sapi header callback routine
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 05:01:28 2025 UTC