summaryrefslogtreecommitdiff
path: root/ext/bz2
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bz2')
-rw-r--r--ext/bz2/bz2.c3
-rw-r--r--ext/bz2/bz2_filter.c4
-rw-r--r--ext/bz2/tests/003-mb.phpt40
-rw-r--r--ext/bz2/tests/003私はガラスを食べられます.txt.bz2bin0 -> 126 bytes
4 files changed, 44 insertions, 3 deletions
diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c
index d0daa8e4f0..45b309d275 100644
--- a/ext/bz2/bz2.c
+++ b/ext/bz2/bz2.c
@@ -327,7 +327,8 @@ static php_stream_wrapper_ops bzip2_stream_wops = {
NULL, /* unlink */
NULL, /* rename */
NULL, /* mkdir */
- NULL /* rmdir */
+ NULL, /* rmdir */
+ NULL
};
static php_stream_wrapper php_stream_bzip2_wrapper = {
diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c
index b076f9554e..2211549fe8 100644
--- a/ext/bz2/bz2_filter.c
+++ b/ext/bz2/bz2_filter.c
@@ -379,7 +379,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
/* How much memory to allocate (1 - 9) x 100kb */
zend_long blocks = zval_get_long(tmpzval);
if (blocks < 1 || blocks > 9) {
- php_error_docref(NULL, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%pd)", blocks);
+ php_error_docref(NULL, E_WARNING, "Invalid parameter given for number of blocks to allocate. (" ZEND_LONG_FMT ")", blocks);
} else {
blockSize100k = (int) blocks;
}
@@ -389,7 +389,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
/* Work Factor (0 - 250) */
zend_long work = zval_get_long(tmpzval);
if (work < 0 || work > 250) {
- php_error_docref(NULL, E_WARNING, "Invalid parameter given for work factor. (%pd)", work);
+ php_error_docref(NULL, E_WARNING, "Invalid parameter given for work factor. (" ZEND_LONG_FMT ")", work);
} else {
workFactor = (int) work;
}
diff --git a/ext/bz2/tests/003-mb.phpt b/ext/bz2/tests/003-mb.phpt
new file mode 100644
index 0000000000..fbc683cb72
--- /dev/null
+++ b/ext/bz2/tests/003-mb.phpt
@@ -0,0 +1,40 @@
+--TEST--
+bzread() tests
+--SKIPIF--
+<?php if (!extension_loaded("bz2")) print "skip"; ?>
+--FILE--
+<?php
+
+$fd = bzopen(dirname(__FILE__)."/003私はガラスを食べられます.txt.bz2","r");
+var_dump(bzread());
+var_dump(bzread($fd, 1 ,0));
+var_dump(bzread($fd, 0));
+var_dump(bzread($fd, -10));
+var_dump(bzread($fd, 1));
+var_dump(bzread($fd, 2));
+var_dump(bzread($fd, 100000));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: bzread() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+
+Warning: bzread() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+string(0) ""
+
+Warning: bzread(): length may not be negative in %s on line %d
+bool(false)
+string(1) "R"
+string(2) "is"
+string(251) "ing up from the heart of the desert
+Rising up for Jerusalem
+Rising up from the heat of the desert
+Building up Old Jerusalem
+Rising up from the heart of the desert
+Rising up for Jerusalem
+Rising up from the heat of the desert
+Heading out for Jerusalem
+"
+Done
diff --git a/ext/bz2/tests/003私はガラスを食べられます.txt.bz2 b/ext/bz2/tests/003私はガラスを食べられます.txt.bz2
new file mode 100644
index 0000000000..034cd4d8b7
--- /dev/null
+++ b/ext/bz2/tests/003私はガラスを食べられます.txt.bz2
Binary files differ