PHP  
 PHP_7_0
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/zlib/tests/inflate_add_basic.phpt ('Test incremental inflate_add() functionality')

Script

1: <?php
2:
function inflateStream($mode$flushSize) {
3:     
$buffer "";
4:     
$inflated null;
5:     
$resource inflate_init($mode);
6:
7:     while (
true) {
8:         
$dataToInflate yield $inflated;
9:         if (isset(
$dataToInflate)) {
10:             
$buffer .= $dataToInflate;
11:             if (
strlen($buffer) >= $flushSize) {
12:                 
$inflated inflate_add($resource$buffer);
13:                 
$buffer "";
14:             } else {
15:                 
$inflated null;
16:             }
17:         } else {
18:             
$inflated inflate_add($resource$bufferZLIB_FINISH);
19:         }
20:     }
21: }
22:
23:
$modes = [
24:     
'ZLIB_ENCODING_RAW'     => ZLIB_ENCODING_RAW,
25:     
'ZLIB_ENCODING_GZIP'    => ZLIB_ENCODING_GZIP,
26:     
'ZLIB_ENCODING_DEFLATE' => ZLIB_ENCODING_DEFLATE,
27: ];
28:
$flushSizes = [1432768];
29:
$flushTypes = [
30:     
'ZLIB_SYNC_FLUSH' => ZLIB_SYNC_FLUSH,
31:     
'ZLIB_PARTIAL_FLUSH' => ZLIB_PARTIAL_FLUSH,
32:     
'ZLIB_FULL_FLUSH' => ZLIB_FULL_FLUSH,
33:     
'ZLIB_NO_FLUSH' => ZLIB_NO_FLUSH,
34:     
'ZLIB_BLOCK' => ZLIB_BLOCK,
35: ];
36:
37:
$uncompressed "";
38: for (
$i=0;$i<(32768*2);$i++) {
39:     
$uncompressed .= chr(rand(48,125));
40: }
41:
42: foreach (
$modes as $modeKey => $mode) {
43:     
$compressed zlib_encode($uncompressed$mode);
44:     
$compressedLen strlen($compressed);
45:     foreach (
$flushSizes as $flushSize) {
46:         foreach (
$flushTypes as $flushTypeKey => $flushType) {
47:             
$inflated "";
48:             
$stream inflateStream($mode$flushSize$flushType);
49:             for (
$i=0;$i<$compressedLen;$i++) {
50:                 
$inflated .= $stream->send($compressed[$i]);
51:             }
52:             
$inflated .= $stream->send(null);
53:             if (
$inflated !== $uncompressed) {
54:                 echo 
"Error: {$modeKey} | {$flushSize} | {$flushTypeKey}\n";
55:             }
56:         }
57:
58:     }
59: }
60:
61:
?>
62:
===DONE===
63:

Expected

===DONE===

Output

** ERROR: process timed out **

Diff

001+ ** ERROR: process timed out **
001- ===DONE===

 

Generated at Wed, 20 Sep 2017 13:49:37 +0000 (2 days ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.