bug64166.phpt 925 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Bug #64166: quoted-printable-encode stream filter incorrectly discarding whitespace
  3. --FILE--
  4. <?php
  5. function test_64166($data) {
  6. $fd = fopen('php://temp', 'w+');
  7. fwrite($fd, $data);
  8. rewind($fd);
  9. $res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array(
  10. 'line-break-chars' => "\n",
  11. 'line-length' => 74
  12. ));
  13. var_dump(stream_get_contents($fd, -1, 0));
  14. stream_filter_remove($res);
  15. rewind($fd);
  16. stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array(
  17. 'line-break-chars' => "\n",
  18. 'line-length' => 6
  19. ));
  20. var_dump(stream_get_contents($fd, -1, 0));
  21. fclose($fd);
  22. }
  23. test_64166("FIRST \nSECOND");
  24. test_64166("FIRST \nSECOND");
  25. ?>
  26. --EXPECT--
  27. string(15) "FIRST=20
  28. SECOND"
  29. string(19) "FIRST=
  30. =20
  31. SECON=
  32. D"
  33. string(18) "FIRST=20=20
  34. SECOND"
  35. string(24) "FIRST=
  36. =20=
  37. =20
  38. SECON=
  39. D"