File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -41,9 +41,13 @@ $flushTypes = [
41
41
'ZLIB_PARTIAL_FLUSH ' => ZLIB_PARTIAL_FLUSH ,
42
42
'ZLIB_FULL_FLUSH ' => ZLIB_FULL_FLUSH ,
43
43
'ZLIB_NO_FLUSH ' => ZLIB_NO_FLUSH ,
44
- 'ZLIB_BLOCK ' => ZLIB_BLOCK ,
45
44
];
46
45
46
+ /* Z_BLOCK is only defined when built against zlib > 1.2.3 */
47
+ if (defined (ZLIB_BLOCK )) {
48
+ $ flushTypes ['ZLIB_BLOCK ' ] = ZLIB_BLOCK ;
49
+ }
50
+
47
51
foreach ($ modes as $ modeKey => $ mode ) {
48
52
foreach ($ flushSizes as $ flushSize ) {
49
53
foreach ($ flushTypes as $ flushTypeKey => $ flushType ) {
Original file line number Diff line number Diff line change @@ -40,9 +40,13 @@ $flushTypes = [
40
40
'ZLIB_PARTIAL_FLUSH ' => ZLIB_PARTIAL_FLUSH ,
41
41
'ZLIB_FULL_FLUSH ' => ZLIB_FULL_FLUSH ,
42
42
'ZLIB_NO_FLUSH ' => ZLIB_NO_FLUSH ,
43
- 'ZLIB_BLOCK ' => ZLIB_BLOCK ,
44
43
];
45
44
45
+ /* Z_BLOCK is only defined when built against zlib > 1.2.3 */
46
+ if (defined (ZLIB_BLOCK )) {
47
+ $ flushTypes ['ZLIB_BLOCK ' ] = ZLIB_BLOCK ;
48
+ }
49
+
46
50
$ uncompressed = "" ;
47
51
for ($ i =0 ;$ i <(32768 *2 );$ i ++) {
48
52
$ uncompressed .= chr (rand (48 ,125 ));
Original file line number Diff line number Diff line change 46
46
#undef gzseek
47
47
#undef gztell
48
48
49
+ /* Z_BLOCK was added in zlib 1.2.4 and stable distros (RHEL6, at least) still
50
+ * package zlib 1.2.3
51
+ */
52
+ #ifdef Z_BLOCK
53
+ #define HAVE_Z_BLOCK 1
54
+ #endif
55
+
49
56
int le_deflate ;
50
57
int le_inflate ;
51
58
@@ -814,7 +821,9 @@ PHP_FUNCTION(inflate_add)
814
821
case Z_PARTIAL_FLUSH :
815
822
case Z_SYNC_FLUSH :
816
823
case Z_FULL_FLUSH :
824
+ #ifdef HAVE_Z_BLOCK
817
825
case Z_BLOCK :
826
+ #endif
818
827
case Z_FINISH :
819
828
break ;
820
829
@@ -960,7 +969,9 @@ PHP_FUNCTION(deflate_add)
960
969
case Z_PARTIAL_FLUSH :
961
970
case Z_SYNC_FLUSH :
962
971
case Z_FULL_FLUSH :
972
+ #ifdef HAVE_Z_BLOCK
963
973
case Z_BLOCK :
974
+ #endif
964
975
case Z_FINISH :
965
976
break ;
966
977
@@ -1268,7 +1279,9 @@ static PHP_MINIT_FUNCTION(zlib)
1268
1279
REGISTER_LONG_CONSTANT ("ZLIB_PARTIAL_FLUSH" , Z_PARTIAL_FLUSH , CONST_CS |CONST_PERSISTENT );
1269
1280
REGISTER_LONG_CONSTANT ("ZLIB_SYNC_FLUSH" , Z_SYNC_FLUSH , CONST_CS |CONST_PERSISTENT );
1270
1281
REGISTER_LONG_CONSTANT ("ZLIB_FULL_FLUSH" , Z_FULL_FLUSH , CONST_CS |CONST_PERSISTENT );
1282
+ #ifdef HAVE_Z_BLOCK
1271
1283
REGISTER_LONG_CONSTANT ("ZLIB_BLOCK" , Z_BLOCK , CONST_CS |CONST_PERSISTENT );
1284
+ #endif
1272
1285
REGISTER_LONG_CONSTANT ("ZLIB_FINISH" , Z_FINISH , CONST_CS |CONST_PERSISTENT );
1273
1286
REGISTER_INI_ENTRIES ();
1274
1287
return SUCCESS ;
You can’t perform that action at this time.
0 commit comments