X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_response_object.c;h=a0b8817cc218563e95fc758e23af0a826da952eb;hp=2a0cbbd0aaad9db54ec57e4591e469abaf681171;hb=8d25696948ed61d50c417275222117f43069ddd1;hpb=0e41acb9661b95484c212e349f83e34eb3fe84a2 diff --git a/http_response_object.c b/http_response_object.c index 2a0cbbd..a0b8817 100644 --- a/http_response_object.c +++ b/http_response_object.c @@ -1081,13 +1081,11 @@ PHP_METHOD(HttpResponse, send) if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &clean_ob)) { RETURN_FALSE; } - if (SG(headers_sent)) { - http_error(HE_WARNING, HTTP_E_RESPONSE, "Cannot send HttpResponse, headers have already been sent"); - RETURN_FALSE; - } + + HTTP_CHECK_HEADERS_SENT(RETURN_FALSE); sent = GET_STATIC_PROP(sent); - if (zval_is_true(sent)) { + if (Z_LVAL_P(sent)) { http_error(HE_WARNING, HTTP_E_RESPONSE, "Cannot send HttpResponse, response has already been sent"); RETURN_FALSE; } else { @@ -1140,6 +1138,10 @@ PHP_METHOD(HttpResponse, send) if (etag_p) zval_ptr_dtor(&etag_p); if (lmod_p) zval_ptr_dtor(&lmod_p); if (cctl_p) zval_ptr_dtor(&cctl_p); + + if (php_ob_handler_used("blackhole" TSRMLS_CC)) { + RETURN_TRUE; + } } /* content type */ @@ -1238,6 +1240,8 @@ PHP_METHOD(HttpResponse, send) PHP_METHOD(HttpResponse, capture) { NO_ARGS; + + HTTP_CHECK_HEADERS_SENT(RETURN_FALSE); UPD_STATIC_PROP(long, catch, 1);