]> granicus.if.org Git - php/commitdiff
fix #36741 (userstreams testcase have off-by-one error on fseek())
authorAntony Dovgal <tony2001@php.net>
Mon, 20 Mar 2006 22:08:59 +0000 (22:08 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 20 Mar 2006 22:08:59 +0000 (22:08 +0000)
ext/standard/tests/file/userstreams.phpt

index 124825f24ed54c23709c1a4ead230a3f8ec03e12..9b80508b3b1b33f9c3c315628de6952de8d1cdff 100644 (file)
@@ -211,15 +211,15 @@ for ($i = 0; $i < 256; $i++) {
        $whence = $whence_map[array_rand($whence_map, 1)];
        switch($whence) {
                case SEEK_SET:
-                       $offset = rand(0, $DATALEN);
+                       $offset = rand(0, $DATALEN - 1);
                        $position = $offset;
                        break;
                case SEEK_END:
-                       $offset = -rand(0, $DATALEN);
+                       $offset = -rand(0, $DATALEN - 1);
                        $position = $DATALEN + $offset;
                        break;
                case SEEK_CUR:
-                       $offset = rand(0, $DATALEN);
+                       $offset = rand(0, $DATALEN - 1);
                        $offset -= $position;
                        $position += $offset;
                        break;