File: ob_009.phpt

package info (click to toggle)
php-zstd 0.14.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,536 kB
  • sloc: ansic: 30,009; asm: 382; xml: 179; makefile: 3
file content (46 lines) | stat: -rw-r--r-- 715 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--TEST--
checks zstd compression output size is always the same
--SKIPIF--
<?php
include (dirname(__FILE__) . '/ob_skipif.inc');
?>
--ENV--
HTTP_ACCEPT_ENCODING=zstd
--GET--
ob=009
--FILE--
<?php

ini_set('zstd.output_compression', 1);
ini_set('zstd.output_compression_level', '22');

$lens = array();

for ( $i=0 ; $i < 100 ; $i++ ) {
  ob_start();
  phpinfo();
  $html = ob_get_clean();

  $len = strlen($html);

  $lens[$len] = $len;
}

$lens = array_values($lens);

echo "Compressed Lengths\n";

var_dump($lens); // show lengths to help triage in case of failure

// expected headers since its CGI

?>
--EXPECTF--
%s
array(1) {
  [0]=>
  int(%d)
}
--EXPECTHEADERS--
Content-Encoding: zstd
Vary: Accept-Encoding