iliaa Tue Apr 8 00:03:34 2008 UTC
Modified files: (Branch: PHP_5_2)
/php-src NEWS
/php-src/ext/standard http_fopen_wrapper.c
/php-src/ext/imap php_imap.c
Log:
MFB: various bug fixes
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1133&r2=1.2027.2.547.2.1134&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1133 php-src/NEWS:1.2027.2.547.2.1134
--- php-src/NEWS:1.2027.2.547.2.1133 Fri Apr 4 17:39:52 2008
+++ php-src/NEWS Tue Apr 8 00:03:34 2008
@@ -7,7 +7,11 @@
- Fixed possible stack buffer overflow in FastCGI SAPI. (Andrei Nigmatulin)
- Fixed sending of uninitialized paddings which may contain some information.
(Andrei Nigmatulin)
+- Fixed bug #44663 (Crash in imap_mail_compose if "body" parameter invalid).
+ (Ilia)
- Fixed bug #44613 (Crash inside imap_headerinfo()). (Ilia, jmessa)
+- Fixed bug #44603 (Order issues with Content-Type/Length headers on
+ POST). (Ilia)
- Fixed bug #44594 (imap_open() does not validate # of retries parameter).
(Ilia)
- Fixed bug #44557 (Crash in imap_setacl when supplied integer as username)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/http_fopen_wrapper.c?r1=1.99.2.12.2.11&r2=1.99.2.12.2.12&diff_format=u
Index: php-src/ext/standard/http_fopen_wrapper.c
diff -u php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.11
php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.12
--- php-src/ext/standard/http_fopen_wrapper.c:1.99.2.12.2.11 Mon Dec 31
07:20:12 2007
+++ php-src/ext/standard/http_fopen_wrapper.c Tue Apr 8 00:03:34 2008
@@ -19,7 +19,7 @@
| Sara Golemon <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.11 2007/12/31 07:20:12 sebastian
Exp $ */
+/* $Id: http_fopen_wrapper.c,v 1.99.2.12.2.12 2008/04/08 00:03:34 iliaa Exp $
*/
#include "php.h"
#include "php_globals.h"
@@ -105,6 +105,7 @@
char *protocol_version = NULL;
int protocol_version_len = 3; /* Default: "1.0" */
struct timeval timeout;
+ char *user_headers = NULL;
tmp_line[0] = '\0';
@@ -351,10 +352,8 @@
efree(tmp);
tmp = tmp_c;
}
-
- /* Output trimmed headers with \r\n at the end */
- php_stream_write(stream, tmp, strlen(tmp));
- php_stream_write(stream, "\r\n", sizeof("\r\n") - 1);
+
+ user_headers = estrdup(tmp);
/* Make lowercase for easy comparison against
'standard' headers */
php_strtolower(tmp, strlen(tmp));
@@ -452,6 +451,27 @@
}
}
+ if (user_headers) {
+ /* A bit weird, but some servers require that Content-Length be
sent prior to Content-Type for POST
+ * see bug #44603 for details. Since Content-Type maybe part of
user's headers we need to do this check first.
+ */
+ if (
+ header_init &&
+ context &&
+ !(have_header & HTTP_HEADER_CONTENT_LENGTH) &&
+ php_stream_context_get_option(context, "http",
"content", &tmpzval) == SUCCESS &&
+ Z_TYPE_PP(tmpzval) == IS_STRING &&
Z_STRLEN_PP(tmpzval) > 0
+ ) {
+ scratch_len = slprintf(scratch, scratch_len,
"Content-Length: %d\r\n", Z_STRLEN_PP(tmpzval));
+ php_stream_write(stream, scratch, scratch_len);
+ have_header |= HTTP_HEADER_CONTENT_LENGTH;
+ }
+
+ php_stream_write(stream, user_headers, strlen(user_headers));
+ php_stream_write(stream, "\r\n", sizeof("\r\n")-1);
+ efree(user_headers);
+ }
+
/* Request content, such as for POST requests */
if (header_init && context &&
php_stream_context_get_option(context, "http", "content",
&tmpzval) == SUCCESS &&
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.29&r2=1.208.2.7.2.30&diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.29
php-src/ext/imap/php_imap.c:1.208.2.7.2.30
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.29 Wed Apr 2 16:31:51 2008
+++ php-src/ext/imap/php_imap.c Tue Apr 8 00:03:34 2008
@@ -26,7 +26,7 @@
| PHP 4.0 updates: Zeev Suraski <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_imap.c,v 1.208.2.7.2.29 2008/04/02 16:31:51 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.30 2008/04/08 00:03:34 iliaa Exp $ */
#define IMAP41
@@ -3041,8 +3041,8 @@
}
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(body));
- if (zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) &data) !=
SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "body parameter
cannot be empty");
+ if (zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) &data) !=
SUCCESS || Z_TYPE_PP(data) != IS_ARRAY) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "body parameter
must be a non-empty array");
RETURN_FALSE;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php