compression is just a binary thing.
Write unicode and suffer my wrath!
<?php if (!extension_loaded("bz2")) print "skip"; ?>
--FILE--
<?php /* $Id$ */
-$text = 'I am the very model of a modern major general, I\'ve information vegetable, animal, and mineral.';
+$text = b'I am the very model of a modern major general, I\'ve information vegetable, animal, and mineral.';
$fp = fopen('php://stdout', 'w');
stream_filter_append($fp, 'bzip2.compress', STREAM_FILTER_WRITE);
<?php if (!extension_loaded("bz2")) print "skip"; ?>
--FILE--
<?php /* $Id$ */
-$text = 'QlpoNDFBWSZTWRN6QG0AAAoVgECFACA395UgIABIintI1N6mpowIQ0E1MTTAQGYTNcRyMZm5kgW3ib7hVboE7Tmqj3ToGZ5G3q1ZauD2G58hibSck8KS95EEAbx1Cn+LuSKcKEgJvSA2gA==';
+$text = b'QlpoNDFBWSZTWRN6QG0AAAoVgECFACA395UgIABIintI1N6mpowIQ0E1MTTAQGYTNcRyMZm5kgW3ib7hVboE7Tmqj3ToGZ5G3q1ZauD2G58hibSck8KS95EEAbx1Cn+LuSKcKEgJvSA2gA==';
$fp = fopen('php://stdout', 'w');
stream_filter_append($fp, 'convert.base64-decode', STREAM_FILTER_WRITE);
error_reporting(E_ALL);
$filename = "testfile.bz2";
-$str = "This is a test string.\n";
+$str = b"This is a test string.\n";
$bz = bzopen($filename, "w");
bzwrite($bz, $str);
bzclose($bz);
error_reporting(E_ALL);
# This FAILS
-$blaat = <<<HEREDOC
+$blaat = b<<<HEREDOC
This is some random data
HEREDOC;