gzuncompress_basic1.phpt 978 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Test gzuncompress() function : basic functionality
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded("zlib")) {
  6. print "skip - ZLIB extension not loaded";
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. /* Prototype : string gzuncompress(string data [, int length])
  12. * Description: Unzip a gzip-compressed string
  13. * Source code: ext/zlib/zlib.c
  14. * Alias to functions:
  15. */
  16. include(dirname(__FILE__) . '/data.inc');
  17. echo "*** Testing gzuncompress() : basic functionality ***\n";
  18. // Initialise all required variables
  19. $compressed = gzcompress($data);
  20. echo "\n-- Basic decompress --\n";
  21. var_dump(strcmp($data, gzuncompress($compressed)));
  22. $length = 3547;
  23. echo "\n-- Calling gzuncompress() with max length of $length --\n";
  24. echo "Result length is ". strlen(gzuncompress($compressed, $length)) . "\n";
  25. ?>
  26. ===DONE===
  27. --EXPECT--
  28. *** Testing gzuncompress() : basic functionality ***
  29. -- Basic decompress --
  30. int(0)
  31. -- Calling gzuncompress() with max length of 3547 --
  32. Result length is 3547
  33. ===DONE===