php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66606 Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE
Submitted: 2014-01-29 17:40 UTC Modified: 2015-08-09 01:02 UTC
Votes:9
Avg. Score:3.6 ± 1.3
Reproduced:9 of 9 (100.0%)
Same Version:2 (22.2%)
Same OS:3 (33.3%)
From: pmjones88 at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Built-in web server
PHP Version: 5.5.8 OS: Mac OS X
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: pmjones88 at gmail dot com
New email:
PHP Version: OS:

 

 [2014-01-29 17:40 UTC] pmjones88 at gmail dot com
Description:
------------
The CGI RFC at https://tools.ietf.org/rfc/rfc3875.txt specifies that the Content-Type header value should be stored in CONTENT_TYPE, but the built-in web server stores it in $_SERVER['HTTP_CONTENT_TYPE'] and does not create a $_SERVER['CONTENT_TYPE'] key. (This probably affects CONTENT_LENGTH as well.)

Test script:
---------------
// put this in an index file and un the PHP web server against it,
// then issue `curl -H "Content-Type: application/json" http://localhost:8000`
// and see that there is no CONTENT_TYPE key, only HTTP_CONTENT_TYPE.
var_dump($_SERVER)

Expected result:
----------------
Expected to see a CONTENT_TYPE key.

Actual result:
--------------
Saw only HTTP_CONTENT_TYPE key.

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-08 18:13 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2015-08-09 00:57 UTC] cmb@php.net
-Status: Verified +Status: Analyzed
 [2015-08-09 00:57 UTC] cmb@php.net
Indeed, RFC 3875 section 4.1.3 states:

| If the request includes a message-body, the CONTENT_TYPE
| variable is set to the Internet Media Type [6] of the
| message-body.
| [...]
| The server MUST set this meta-variable if an
| HTTP Content-Type field is present in the client request header.

As there is no particular reason to not to comply with RFC 3875 in
this regard, I consider this a bug that ought to be fixed.

PR #886 is the way to go. Thanks, wusuopu.
 [2015-08-09 01:01 UTC] cmb@php.net
Automatic comment on behalf of admin@longchangjin.cn
Revision: http://git.php.net/?p=php-src.git;a=commit;h=72976e2497f963b7f203443f9881d52e0ff97962
Log: Fix #66606: Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE
 [2015-08-09 01:01 UTC] cmb@php.net
-Status: Analyzed +Status: Closed
 [2015-08-09 01:02 UTC] cmb@php.net
The fix for this bug has been committed.

Thank you for the report, and for helping us make PHP better.
 [2015-08-18 16:24 UTC] ab@php.net
Automatic comment on behalf of admin@longchangjin.cn
Revision: http://git.php.net/?p=php-src.git;a=commit;h=72976e2497f963b7f203443f9881d52e0ff97962
Log: Fix #66606: Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 16:01:33 2024 UTC