--- /dev/null
+--TEST--
+Bug #51997 (SEEK_CUR with 0 value, returns a warning)
+--SKIPIF--
+<?php if (!extension_loaded("bz2")) print "skip"; ?>
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+$filename = "testfile.bz2";
+$str = "This is a test string.\n";
+$bz = bzopen($filename, "w");
+bzwrite($bz, $str);
+bzclose($bz);
+
+$bz = bzopen($filename, "r");
+fseek($bz, 0, SEEK_CUR);
+print bzread($bz, 10);
+print bzread($bz);
+bzclose($bz);
+unlink($filename);
+
+--EXPECT--
+This is a test string.
}
/* emulate forward moving seeks with reads */
- if (whence == SEEK_CUR && offset > 0) {
+ if (whence == SEEK_CUR && offset >= 0) {
char tmp[1024];
size_t didread;
while(offset > 0) {