nikic Sat, 18 Feb 2012 13:39:13 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=323330
Log:
Fix headers generated by phar
sapi_header_line.line_len is the length without null terminator, so one has to
take sizeof - 1. This fixes some test failures as the NUL bytes were causing
warnings.
Needs to be merged to 5.4.
Changed paths:
U php/php-src/branches/PHP_5_3/ext/phar/phar_object.c
U php/php-src/trunk/ext/phar/phar_object.c
Modified: php/php-src/branches/PHP_5_3/ext/phar/phar_object.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2012-02-18 13:14:30 UTC
(rev 323329)
+++ php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2012-02-18 13:39:13 UTC
(rev 323330)
@@ -427,7 +427,7 @@
sapi_header_line ctr = {0};
ctr.response_code = 403;
- ctr.line_len = sizeof("HTTP/1.0 403 Access Denied");
+ ctr.line_len = sizeof("HTTP/1.0 403 Access Denied")-1;
ctr.line = "HTTP/1.0 403 Access Denied";
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
sapi_send_headers(TSRMLS_C);
@@ -452,7 +452,7 @@
}
ctr.response_code = 404;
- ctr.line_len = sizeof("HTTP/1.0 404 Not Found")+1;
+ ctr.line_len = sizeof("HTTP/1.0 404 Not Found")-1;
ctr.line = "HTTP/1.0 404 Not Found";
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
sapi_send_headers(TSRMLS_C);
@@ -891,7 +891,7 @@
char *tmp = NULL, sa = '\0';
sapi_header_line ctr = {0};
ctr.response_code = 301;
- ctr.line_len = sizeof("HTTP/1.1 301 Moved
Permanently")+1;
+ ctr.line_len = sizeof("HTTP/1.1 301 Moved
Permanently")-1;
ctr.line = "HTTP/1.1 301 Moved Permanently";
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
Modified: php/php-src/trunk/ext/phar/phar_object.c
===================================================================
--- php/php-src/trunk/ext/phar/phar_object.c 2012-02-18 13:14:30 UTC (rev
323329)
+++ php/php-src/trunk/ext/phar/phar_object.c 2012-02-18 13:39:13 UTC (rev
323330)
@@ -428,7 +428,7 @@
sapi_header_line ctr = {0};
ctr.response_code = 403;
- ctr.line_len = sizeof("HTTP/1.0 403 Access Denied");
+ ctr.line_len = sizeof("HTTP/1.0 403 Access Denied")-1;
ctr.line = "HTTP/1.0 403 Access Denied";
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
sapi_send_headers(TSRMLS_C);
@@ -453,7 +453,7 @@
}
ctr.response_code = 404;
- ctr.line_len = sizeof("HTTP/1.0 404 Not Found")+1;
+ ctr.line_len = sizeof("HTTP/1.0 404 Not Found")-1;
ctr.line = "HTTP/1.0 404 Not Found";
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
sapi_send_headers(TSRMLS_C);
@@ -893,7 +893,7 @@
char *tmp = NULL, sa = '\0';
sapi_header_line ctr = {0};
ctr.response_code = 301;
- ctr.line_len = sizeof("HTTP/1.1 301 Moved
Permanently")+1;
+ ctr.line_len = sizeof("HTTP/1.1 301 Moved
Permanently")-1;
ctr.line = "HTTP/1.1 301 Moved Permanently";
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php