Hi list,
this code is not working with the current trunk:
| <?php
| header('Content-Language: ');
| ?>
The result is an internale server error:
| [Thu Feb 24 17:21:25 2011] [error] [client ::1] malformed header from
| script. Bad header=Content-Language: php-cgi.exe
Without only a space after ":"
| header('Content-Language:');
or
| header('Content-Language: en-US');
it's working.
Regards,
Carsten
this code is not working with the current trunk:
| <?php |
| header('Content-Language: ');
| ?>The result is an internale server error:
| [Thu Feb 24 17:21:25 2011] [error] [client ::1] malformed header
| from script. Bad header=Content-Language: php-cgi.exeI don't think this is a PHP problem. Everything in the error message
indicates to me that PHP is doing what you told it to do, and the
webserver doesn't like it (for whatever reason). This is either your
fault, or the webserver's fault, and I don't see why PHP should
compensate for it.Ben.
Oh, this only happens with trunk, but not with e.g 5.3.5. But just see
the difference:
test.php
| <?php
| header('Content-Language: ');
| ?>
That's what PHP 5.3.5 is sending to the server:
| X-Powered-By: PHP/5.3.5
| Content-Language:
| Content-type: text/html
And that's what PHP trunk is sending to the server:
| X-Powered-By: PHP/5.3.99-dev
| Content-Language
| Content-type: text/html
see the missing ":" after the header name.
if I'm using this script:
test.php
| <?php
| header('Content-Language:');
| ?>
the output is correct:
| X-Powered-By: PHP/5.3.99-dev
| Content-Language:
| Content-type: text/html
Regards,
Carsten
Am 24.02.2011 23:56, schrieb Carsten Wiedmann:
Oh, this only happens with trunk, but not with e.g 5.3.5. But just see
the difference:
OK, this bug was introduced in r301263. It's removing +1 char while
cutting LWS at the end of a header line.
<<<PATCH
Index: SAPI.c
--- SAPI.c (Revision 308566)
+++ SAPI.c (Arbeitskopie)
@@ -680,7 +680,7 @@
do {
header_line_len--;
} while(header_line_len && isspace(header_line[header_line_len-1]));
-
header_line[--header_line_len]='\0';
-
header_line[header_line_len]='\0';
}
if (op == SAPI_HEADER_DELETE) {
PATCH;
<<<TESTPHPT
--TEST--
header()
function - LWS at end of field-value
--GET--
--FILE--
<?php
header('x-headertest: foo ');
var_dump(headers_list());
?>
--EXPECTREGEX--
.string(17) "x-headertest: foo".
TESTPHPT;
BTW:
PHP is removing LWS at the end of the field-value, but why is it not
replacing LWS between the field-name: and field-value with one SP?
Regards,
Carsten
hi Carsten,
Thanks for the report and the patch (applied)!
Cheers,
Am 24.02.2011 23:56, schrieb Carsten Wiedmann:
Oh, this only happens with trunk, but not with e.g 5.3.5. But just see
the difference:OK, this bug was introduced in r301263. It's removing +1 char while cutting
LWS at the end of a header line.<<<PATCH
Index: SAPI.c--- SAPI.c (Revision 308566)
+++ SAPI.c (Arbeitskopie)
@@ -680,7 +680,7 @@
do {
header_line_len--;
} while(header_line_len &&
isspace(header_line[header_line_len-1]));
- header_line[--header_line_len]='\0';
- header_line[header_line_len]='\0';
}if (op == SAPI_HEADER_DELETE) {
PATCH;<<<TESTPHPT
--TEST--
header()
function - LWS at end of field-value
--GET----FILE--
<?php
header('x-headertest: foo ');
var_dump(headers_list());
?>
--EXPECTREGEX--
.string(17) "x-headertest: foo".
TESTPHPT;BTW:
PHP is removing LWS at the end of the field-value, but why is it not
replacing LWS between the field-name: and field-value with one SP?Regards,
Carsten--
--
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org