bug60761.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. checks zlib compression output size is always the same
  3. --EXTENSIONS--
  4. zlib
  5. --CGI--
  6. --FILE--
  7. <?php
  8. // the INI directives from bug #60761 report
  9. ini_set('zlib.output_compression', '4096');
  10. ini_set('zlib.output_compression_level', '9');
  11. // try to duplicate the original bug by running this as a CGI
  12. // test using ob_start and zlib.output_compression(or ob_gzhandler)
  13. // so it follows more of the original code-path than just calling
  14. // gzcompress on CLI or CGI
  15. $lens = array();
  16. for ( $i=0 ; $i < 100 ; $i++ ) {
  17. // can't use ob_gzhandler with zlib.output_compression
  18. ob_start();//"ob_gzhandler");
  19. phpinfo();
  20. $html = ob_get_clean();
  21. $len = strlen($html);
  22. $lens[$len] = $len;
  23. }
  24. $lens = array_values($lens);
  25. echo "Compressed Lengths\n";
  26. // pass == only ONE length for all iterations
  27. // (length didn't change during run)
  28. //
  29. // hard to anticipate what 'correct' length should be since
  30. // return value of phpinfo() will vary between installations...
  31. // just check that there is only one length
  32. //
  33. var_dump($lens); // show lengths to help triage in case of failure
  34. // expected headers since its CGI
  35. ?>
  36. --EXPECTF--
  37. %s
  38. array(1) {
  39. [0]=>
  40. int(%d)
  41. }