Skip to content

Commit c0be56a

Browse files
committed
fix: disable dcb encoding when dictionary loading fails
1 parent e59f28d commit c0be56a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

brotli.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ static zend_string *php_brotli_output_handler_load_dict(php_brotli_context *ctx)
376376
{
377377
char *file = BROTLI_G(output_compression_dict);
378378
if (!file || strlen(file) == 0) {
379+
BROTLI_G(compression_coding) &= ~PHP_BROTLI_ENCODING_DCB;
379380
return NULL;
380381
}
381382

@@ -392,6 +393,7 @@ static zend_string *php_brotli_output_handler_load_dict(php_brotli_context *ctx)
392393
if (!stream) {
393394
php_error_docref(NULL, E_WARNING,
394395
"brotli: failed to load dictionary");
396+
BROTLI_G(compression_coding) &= ~PHP_BROTLI_ENCODING_DCB;
395397
return NULL;
396398
}
397399

@@ -417,6 +419,7 @@ static zend_string *php_brotli_output_handler_load_dict(php_brotli_context *ctx)
417419
php_stream_close(stream);
418420

419421
if (!dict) {
422+
BROTLI_G(compression_coding) &= ~PHP_BROTLI_ENCODING_DCB;
420423
return NULL;
421424
}
422425

0 commit comments

Comments
 (0)