From: Raghubansh Kumar Date: Sun, 22 Jul 2007 17:27:35 +0000 (+0000) Subject: New testcases for fread() functions X-Git-Tag: php-5.2.4RC1~89 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=58bae48bf43b4107cba23607b2a84f83fbf462f8;p=php New testcases for fread() functions --- diff --git a/ext/standard/tests/file/fread_variation1.phpt b/ext/standard/tests/file/fread_variation1.phpt new file mode 100644 index 0000000000..c46dbe2a3c --- /dev/null +++ b/ext/standard/tests/file/fread_variation1.phpt @@ -0,0 +1,657 @@ +--TEST-- +Test fread() function : usage variations - read some/all chars, read/write modes +--FILE-- + +--EXPECTF-- +*** Testing fread() : usage variations *** + +-- Testing fread() with file having content of type numeric -- +-- File opened in mode a+ -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +-- File opened in mode a+b -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +-- File opened in mode a+t -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +-- File opened in mode w+ -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +-- File opened in mode w+b -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +-- File opened in mode w+t -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +-- File opened in mode x+ -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +-- File opened in mode x+b -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" +-- File opened in mode x+t -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "4501f99f2b79d0345f26f1394aca58a3" + +-- Testing fread() with file having content of type text -- +-- File opened in mode a+ -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +-- File opened in mode a+b -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +-- File opened in mode a+t -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +-- File opened in mode w+ -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +-- File opened in mode w+b -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +-- File opened in mode w+t -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +-- File opened in mode x+ -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +-- File opened in mode x+b -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" +-- File opened in mode x+t -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd" + +-- Testing fread() with file having content of type text_with_new_line -- +-- File opened in mode a+ -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +-- File opened in mode a+b -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +-- File opened in mode a+t -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +-- File opened in mode w+ -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +-- File opened in mode w+b -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +-- File opened in mode w+t -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +-- File opened in mode x+ -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +-- File opened in mode x+b -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" +-- File opened in mode x+t -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a148fa8110bbac875d84fc9d7056c0a1" + +-- Testing fread() with file having content of type alphanumeric -- +-- File opened in mode a+ -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +-- File opened in mode a+b -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +-- File opened in mode a+t -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +-- File opened in mode w+ -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +-- File opened in mode w+b -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +-- File opened in mode w+t -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +-- File opened in mode x+ -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +-- File opened in mode x+b -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +-- File opened in mode x+t -- +-- Reading entire file content, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(false) +string(32) "3fabd48d8eaa65c14e0d93d6880c560c" +-- Reading file content less than max. file size, expeceted : 1000 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 1000 bytes ... OK +int(1000) +bool(false) +string(32) "a49d752f980184c7f44568e930f89c72" +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fread_variation2.phpt b/ext/standard/tests/file/fread_variation2.phpt new file mode 100644 index 0000000000..5ad1ba6e87 --- /dev/null +++ b/ext/standard/tests/file/fread_variation2.phpt @@ -0,0 +1,656 @@ +--TEST-- +Test fread() function : usage variations - read some/all chars, write only mode(fails, see bug#42036) +--FILE-- + +--EXPECTF-- +*** Testing fread() : usage variations *** + +-- Testing fread() with file having content of type numeric -- +-- File opened in mode a -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode ab -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode at -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode w -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode wb -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode wt -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode x -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode xb -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode xt -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + + +-- Testing fread() with file having content of type text -- +-- File opened in mode a -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode ab -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode at -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode w -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode wb -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode wt -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode x -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode xb -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode xt -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + + +-- Testing fread() with file having content of type text_with_new_line -- +-- File opened in mode a -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode ab -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode at -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode w -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode wb -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode wt -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode x -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode xb -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode xt -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + + +-- Testing fread() with file having content of type alphanumeric -- +-- File opened in mode a -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode ab -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode at -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode w -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode wb -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode wt -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode x -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode xb -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- File opened in mode xt -- +-- Reading entire file content, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1024 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +-- Reading file content less than max. file size, expeceted : 0 bytes -- +int(0) +bool(false) +Reading 1000 bytes from file, expecting 0 bytes ... OK +int(0) +bool(false) + +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fread_variation3.phpt b/ext/standard/tests/file/fread_variation3.phpt new file mode 100644 index 0000000000..949e7b8869 --- /dev/null +++ b/ext/standard/tests/file/fread_variation3.phpt @@ -0,0 +1,498 @@ +--TEST-- +Test fread() function : usage variations - read beyond file size, read/write mode +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing fread() : usage variations *** + +-- Testing fread() with file having content of type numeric -- +-- File opened in mode a+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode a+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode a+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "950b7457d1deb6332f2fc5d42f3129d6" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) + +-- Testing fread() with file having content of type text -- +-- File opened in mode a+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode a+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode a+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "e486000c4c8452774f746a27658d87fa" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) + +-- Testing fread() with file having content of type text_with_new_line -- +-- File opened in mode a+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode a+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode a+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+ -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+b -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x+t -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 1024 bytes ... OK +int(1024) +bool(true) +string(32) "b09c8026a64a88d36d4c2f17983964bb" +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +Done \ No newline at end of file diff --git a/ext/standard/tests/file/fread_variation4.phpt b/ext/standard/tests/file/fread_variation4.phpt new file mode 100644 index 0000000000..1c21b9b5d1 --- /dev/null +++ b/ext/standard/tests/file/fread_variation4.phpt @@ -0,0 +1,469 @@ +--TEST-- +Test fread() function : usage variations - read beyond file size, write only mode +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing fread() : usage variations *** + +-- Testing fread() with file having content of type numeric -- +-- File opened in mode a -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode ab -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode at -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode wb -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode wt -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode xb -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode xt -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) + +-- Testing fread() with file having content of type text -- +-- File opened in mode a -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode ab -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode at -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode wb -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode wt -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode xb -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode xt -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) + +-- Testing fread() with file having content of type text_with_new_line -- +-- File opened in mode a -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode ab -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode at -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode w -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode wb -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode wt -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode x -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode xb -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +-- File opened in mode xt -- +-- Reading beyond filesize, expeceted : 1024 bytes -- +int(0) +bool(false) +Reading 1030 bytes from file, expecting 0 bytes ... OK +int(0) +bool(true) +-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes -- +int(1024) +bool(false) +Reading 10 bytes from file, expecting 0 bytes ... OK +int(1024) +bool(true) +Done \ No newline at end of file