- get rid of 1001 strict-aliasing warnings
[m6w6/ext-http] / http_api.c
index 285c030836bc8ef2c6c3b1d80b06c19967d6b802..c932266c5d38f75a5b315c26f76fdb3692459921 100644 (file)
@@ -116,7 +116,7 @@ void _http_log_ex(char *file, const char *ident, const char *message TSRMLS_DC)
 
 #define HTTP_LOG_WRITE(file, type, msg) \
        if (file && *file) { \
-               php_stream *log = php_stream_open_wrapper(file, "ab", REPORT_ERRORS|ENFORCE_SAFE_MODE, HTTP_DEFAULT_STREAM_CONTEXT); \
+               php_stream *log = php_stream_open_wrapper_ex(file, "ab", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL, HTTP_DEFAULT_STREAM_CONTEXT); \
                 \
                if (log) { \
                        php_stream_printf(log TSRMLS_CC, "%s\t[%s]\t%s\t<%s>%s", datetime, type, msg, SG(request_info).request_uri, PHP_EOL); \
@@ -147,7 +147,9 @@ STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header
                return FAILURE;
        }
        
-       php_end_ob_buffers(0 TSRMLS_CC);
+       if (!OG(ob_lock)) {
+               php_end_ob_buffers(0 TSRMLS_CC);
+       }
        if ((SUCCESS == sapi_send_headers(TSRMLS_C)) && body) {
                PHPWRITE(body, strlen(body));
        }
@@ -196,11 +198,13 @@ PHP_HTTP_API zval *_http_get_server_var_ex(const char *key, size_t key_size, zen
 {
        zval **hsv;
        zval **var;
-       
-       if ((SUCCESS != zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **) &hsv)) || (Z_TYPE_PP(hsv) != IS_ARRAY)) {
+#ifdef ZEND_ENGINE_2
+       zend_is_auto_global("_SERVER", lenof("_SERVER") TSRMLS_CC);
+#endif
+       if ((SUCCESS != zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void *) &hsv)) || (Z_TYPE_PP(hsv) != IS_ARRAY)) {
                return NULL;
        }
-       if ((SUCCESS != zend_hash_find(Z_ARRVAL_PP(hsv), (char *) key, key_size, (void **) &var)) || (Z_TYPE_PP(var) != IS_STRING)) {
+       if ((SUCCESS != zend_hash_find(Z_ARRVAL_PP(hsv), (char *) key, key_size, (void *) &var)) || (Z_TYPE_PP(var) != IS_STRING)) {
                return NULL;
        }
        if (check && !(Z_STRVAL_PP(var) && Z_STRLEN_PP(var))) {