From: Thies C. Arntzen Date: Thu, 15 Feb 2001 14:49:01 +0000 (+0000) Subject: @- Fixed some modules to allow using output-buffering. (Thies) X-Git-Tag: php-4.0.5RC1~276 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8499b430cff13387bc2f6232f184db506cefe52f;p=php @- Fixed some modules to allow using output-buffering. (Thies) i nuked all unneded calls to php_header() - i'm not too sure how we do handle HEAD Requests as they were only detected via php_header(). but calling php_header from a module makes output-buffering unusable. NOTICE: there is some EBSDIC stuff in gd.c - i think it's obsolete. --- diff --git a/ext/cpdf/cpdf.c b/ext/cpdf/cpdf.c index 5bf8ea2900..0e32963872 100644 --- a/ext/cpdf/cpdf.c +++ b/ext/cpdf/cpdf.c @@ -2226,7 +2226,7 @@ PHP_FUNCTION(cpdf_output_buffer) { } buffer = cpdf_getBufferForPDF(pdf, &lenght); - php_header(); + php_write(buffer, lenght); RETURN_TRUE; diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 1a8ebe507d..32defd355a 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -853,33 +853,35 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char php_error(E_WARNING, "%s: unable to open temporary file", get_active_function_name()); RETURN_FALSE; } - output = php_header(); - if (output) { - switch(image_type) { - case PHP_GDIMG_TYPE_JPG: - (*func_p)(im, tmp, q); - break; - case PHP_GDIMG_TYPE_WBM: - if(q<0||q>255) { - php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(), q); - } - (*func_p)(im, q, tmp); - break; - default: - (*func_p)(im, tmp); - break; - } - fseek(tmp, 0, SEEK_SET); + switch(image_type) { + case PHP_GDIMG_TYPE_JPG: + (*func_p)(im, tmp, q); + break; + case PHP_GDIMG_TYPE_WBM: + if(q<0||q>255) { + php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(), q); + } + (*func_p)(im, q, tmp); + break; + default: + (*func_p)(im, tmp); + break; + } + + fseek(tmp, 0, SEEK_SET); + #if APACHE && defined(CHARSET_EBCDIC) - SLS_FETCH(); - /* This is a binary file already: avoid EBCDIC->ASCII conversion */ - ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0); + /* XXX this is unlikely to work any more thies@thieso.net */ + + SLS_FETCH(); + /* This is a binary file already: avoid EBCDIC->ASCII conversion */ + ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0); #endif - while ((b = fread(buf, 1, sizeof(buf), tmp)) > 0) { - php_write(buf, b); - } - } + while ((b = fread(buf, 1, sizeof(buf), tmp)) > 0) { + php_write(buf, b); + } + fclose(tmp); /* the temporary file is automatically deleted */ } diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index f54b8a5b96..f187483e23 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -61,15 +61,13 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, ctx = gdNewFileCtx(fp); } else { - if(!php_header()) { - RETURN_TRUE; - } ctx = emalloc(sizeof(gdIOCtx)); ctx->putC = _php_image_output_putc; ctx->putBuf = _php_image_output_putbuf; ctx->free = _php_image_output_ctxfree; #if APACHE && defined(CHARSET_EBCDIC) + /* XXX this is unlikely to work any more thies@thieso.net */ SLS_FETCH(); /* This is a binary file already: avoid EBCDIC->ASCII conversion */ ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0); diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c index 12f4b195ca..39e5b06be0 100644 --- a/ext/hyperwave/hw.c +++ b/ext/hyperwave/hw.c @@ -2766,8 +2766,7 @@ PHP_FUNCTION(hw_output_document) { RETURN_FALSE; } - if(php_header()) - php_write(ptr->data, ptr->size); + php_write(ptr->data, ptr->size); RETURN_TRUE; } diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c index a1806b0976..2a815fec20 100644 --- a/ext/interbase/interbase.c +++ b/ext/interbase/interbase.c @@ -2831,10 +2831,6 @@ PHP_FUNCTION(ibase_blob_echo) GET_BLOB_ID_ARG(blob_arg, ib_blob_id); - if (!php_header()) { - RETURN_FALSE; - } - if (ib_blob_id) { /*not null ?*/ if (isc_open_blob(IB_STATUS, &ib_blob_id->link, &ib_blob_id->trans_handle, diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index b8c5d5807e..f504827e0c 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -834,9 +834,7 @@ static void oci_debug(const char *format, ...) vsnprintf(buffer, sizeof(buffer)-1, format, args); va_end(args); buffer[sizeof(buffer)-1] = '\0'; - if (php_header()) { - php_printf("OCIDebug: %s
\n", buffer); - } + php_printf("OCIDebug: %s
\n", buffer); } } @@ -2959,9 +2957,7 @@ PHP_FUNCTION(ociwritelobtofile) goto bail; } } else { - if (php_header()) { - PHPWRITE(buffer,toread); - } + PHPWRITE(buffer,toread); } length -= toread; diff --git a/ext/pdf/pdf.c b/ext/pdf/pdf.c index b42227355d..c8bc728301 100644 --- a/ext/pdf/pdf.c +++ b/ext/pdf/pdf.c @@ -250,7 +250,7 @@ static void pdf_efree(PDF *p, void *mem) static size_t pdf_flushwrite(PDF *p, void *data, size_t size) { - if(php_header()) return(php_write(data, size)); + return(php_write(data, size)); return 0; } diff --git a/ext/standard/file.c b/ext/standard/file.c index 63d14053d9..e8e5448d39 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1437,9 +1437,7 @@ PHP_FUNCTION(readfile) rsrc_id = ZEND_REGISTER_RESOURCE(NULL,fp,php_file_le_fopen()); } - if (php_header()) { - size = php_passthru_fd(socketd, fp, issock); - } + size = php_passthru_fd(socketd, fp, issock); zend_list_delete(rsrc_id); @@ -1497,12 +1495,10 @@ PHP_FUNCTION(fpassthru) socketd=*(int*)what; } - size = 0; - if (php_header()) { /* force headers if not already sent */ - size = php_passthru_fd(socketd, (FILE*) what, issock); - } + size = php_passthru_fd(socketd, (FILE*) what, issock); zend_list_delete((*arg1)->value.lval); + RETURN_LONG(size); } /* }}} */ diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index 0fdab46b2c..4865d0c050 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -203,16 +203,6 @@ PHP_FUNCTION(iptcembed) RETURN_FALSE; } - if (spool > 0) - if (!php_header()){ /* we got a HEAD request. */ - if (spool == 2){ - RETURN_TRUE; /* we only wanted to spool - report success. */ - } else - if (spool == 1) { - spool = 0; /* we wanted the file to be spooled/returned, just return it */ - } - } - len = (*iptcdata)->value.str.len; if (spool < 2) {