mirror of
https://github.com/php/php-src.git
synced 2025-08-18 23:18:56 +02:00
Users can shoot themselves by their own output handler always.
Therefore, this check is overkill and it should be documented limitation, IMO. Anyway, a little optimization.
This commit is contained in:
parent
6477b0b5d8
commit
ecf146cbce
1 changed files with 18 additions and 15 deletions
|
@ -388,23 +388,26 @@ static int php_ob_init_named(uint initial_size, uint block_size, char *handler_n
|
|||
{
|
||||
int handler_gz, handler_mb, handler_ic;
|
||||
|
||||
/* check for specific handlers where rules apply */
|
||||
handler_gz = strcmp(handler_name, "ob_gzhandler");
|
||||
handler_mb = strcmp(handler_name, "mb_output_handler");
|
||||
handler_ic = strcmp(handler_name, "ob_iconv_handler");
|
||||
/* apply rules */
|
||||
if (!handler_gz || !handler_mb || !handler_ic) {
|
||||
if (php_ob_handler_used(handler_name TSRMLS_CC)) {
|
||||
php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler '%s' cannot be used twice", handler_name);
|
||||
return FAILURE;
|
||||
if (OG(ob_nesting_level>1)) {
|
||||
/* check for specific handlers where rules apply */
|
||||
handler_gz = strcmp(handler_name, "ob_gzhandler");
|
||||
handler_mb = strcmp(handler_name, "mb_output_handler");
|
||||
handler_ic = strcmp(handler_name, "ob_iconv_handler");
|
||||
/* apply rules */
|
||||
if (!handler_gz || !handler_mb || !handler_ic) {
|
||||
if (php_ob_handler_used(handler_name TSRMLS_CC)) {
|
||||
php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler '%s' cannot be used twice", handler_name);
|
||||
return FAILURE;
|
||||
}
|
||||
if (!handler_gz && php_ob_init_conflict(handler_name, "zlib output compression" TSRMLS_CC))
|
||||
return FAILURE;
|
||||
if (!handler_mb && php_ob_init_conflict(handler_name, "ob_iconv_handler" TSRMLS_CC))
|
||||
return FAILURE;
|
||||
if (!handler_ic && php_ob_init_conflict(handler_name, "mb_output_handler" TSRMLS_CC))
|
||||
return FAILURE;
|
||||
}
|
||||
if (!handler_gz && php_ob_init_conflict(handler_name, "zlib output compression" TSRMLS_CC))
|
||||
return FAILURE;
|
||||
if (!handler_mb && php_ob_init_conflict(handler_name, "ob_iconv_handler" TSRMLS_CC))
|
||||
return FAILURE;
|
||||
if (!handler_ic && php_ob_init_conflict(handler_name, "mb_output_handler" TSRMLS_CC))
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (OG(ob_nesting_level)>0) {
|
||||
if (OG(ob_nesting_level)==1) { /* initialize stack */
|
||||
zend_stack_init(&OG(ob_buffers));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue