@@ -784,6 +784,12 @@ PHP_INI_BEGIN()
784784 STD_PHP_INI_ENTRY ("brotli.output_compression_dict" , "" ,
785785 PHP_INI_ALL , OnUpdateString , output_compression_dict ,
786786 zend_brotli_globals , brotli_globals )
787+ #if defined(HAVE_APCU_SUPPORT )
788+ STD_PHP_INI_ENTRY ("brotli.apcu_compression_level" ,
789+ TOSTRING (BROTLI_DEFAULT_QUALITY ),
790+ PHP_INI_ALL , OnUpdateLong , apcu_compression_level ,
791+ zend_brotli_globals , brotli_globals )
792+ #endif
787793PHP_INI_END ()
788794
789795static void php_brotli_init_globals (zend_brotli_globals * brotli_globals )
@@ -1452,6 +1458,7 @@ ZEND_MINFO_FUNCTION(brotli)
14521458 php_info_print_table_row (2 , "APCu serializer ABI" , APC_SERIALIZER_ABI );
14531459#endif
14541460 php_info_print_table_end ();
1461+ DISPLAY_INI_ENTRIES ();
14551462}
14561463
14571464#if defined(HAVE_APCU_SUPPORT )
@@ -1837,11 +1844,16 @@ static ZEND_FUNCTION(brotli_uncompress_add)
18371844static int APC_SERIALIZER_NAME (brotli )(APC_SERIALIZER_ARGS )
18381845{
18391846 int result ;
1840- int lgwin = BROTLI_DEFAULT_WINDOW , level = BROTLI_DEFAULT_QUALITY ;
1847+ int lgwin = BROTLI_DEFAULT_WINDOW ;
1848+ long level = BROTLI_G (apcu_compression_level );
18411849 php_serialize_data_t var_hash ;
18421850 smart_str var = {0 };
18431851 BrotliEncoderMode mode = BROTLI_MODE_GENERIC ;
18441852
1853+ if (level < BROTLI_MIN_QUALITY || level > BROTLI_MAX_QUALITY ) {
1854+ level = BROTLI_DEFAULT_QUALITY ;
1855+ }
1856+
18451857 PHP_VAR_SERIALIZE_INIT (var_hash );
18461858 php_var_serialize (& var , (zval * ) value , & var_hash );
18471859 PHP_VAR_SERIALIZE_DESTROY (var_hash );
0 commit comments