summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it.class4
-rwxr-xr-xtest/it.t13
2 files changed, 10 insertions, 7 deletions
diff --git a/it.class b/it.class
index 442fd66..41b9eb7 100644
--- a/it.class
+++ b/it.class
@@ -1198,9 +1198,9 @@ static function safe_filename($filename)
return $filename;
}
-static function file_get_contents($filename, $use_include_path = false, $context = null, $offset = 0)
+static function file_get_contents($filename, ...$args)
{
- return file_get_contents(it::safe_filename($filename), $use_include_path, $context, $offset); # NOPHPLINT
+ return file_get_contents(it::safe_filename($filename), ...$args); # NOPHPLINT
}
static function file_put_contents($filename, $data, $flags = 0, $resource = null)
diff --git a/test/it.t b/test/it.t
index cc3e9f2..26d0f95 100755
--- a/test/it.t
+++ b/test/it.t
@@ -470,13 +470,16 @@ is(it::split("(b)", "aba", ['delim_capture' => true]), ["a", "b", "a"]);
is(it::split("b", "aabaa", ['offset_capture' => true]), [["aa", 0], ["aa", 3]]);
$tmpfile = tempnam("/tmp", "it_test");
-it::file_put_contents($tmpfile, "aa");
-is(($fh = it::fopen($tmpfile, "r")) ? fgets($fh) : null, "aa");
-is(it::file_get_contents($tmpfile), "aa");
-is(it::file($tmpfile), ["aa"]);
+it::file_put_contents($tmpfile, "abc");
+is(($fh = it::fopen($tmpfile, "r")) ? fgets($fh) : null, "abc");
+is(it::file_get_contents($tmpfile), "abc");
+is(it::file_get_contents($tmpfile, false, null, 1), "bc");
+is(it::file_get_contents($tmpfile, false, null, 0, 2), "ab");
+is(it::file_get_contents($tmpfile, false, null, 1, 1), "b");
+is(it::file($tmpfile), ["abc"]);
ob_start();
it::readfile($tmpfile);
-is(ob_get_clean(), "aa");
+is(ob_get_clean(), "abc");
it::file_put($tmpfile, "bb");
is(it::file_get($tmpfile), "bb");