Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- file() with a range of integer flag values --FILE-- <?php $filepath = __FILE__ ...
Decoded Output download
--TEST--
file() with a range of integer flag values
--FILE--
<?php
$filepath = __FILE__ . ".tmp";
$fd = fopen($filepath, "w+");
fwrite($fd, "Line 1
Line 2
Line 3");
fclose($fd);
for ($flags = 0; $flags <= 32; $flags++) {
try {
var_dump(file($filepath, $flags));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
}
unlink($filepath);
?>
--EXPECT--
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
Did this file decode correctly?
Original Code
--TEST--
file() with a range of integer flag values
--FILE--
<?php
$filepath = __FILE__ . ".tmp";
$fd = fopen($filepath, "w+");
fwrite($fd, "Line 1\nLine 2\nLine 3");
fclose($fd);
for ($flags = 0; $flags <= 32; $flags++) {
try {
var_dump(file($filepath, $flags));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
}
unlink($filepath);
?>
--EXPECT--
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(7) "Line 1
"
[1]=>
string(7) "Line 2
"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
array(3) {
[0]=>
string(6) "Line 1"
[1]=>
string(6) "Line 2"
[2]=>
string(6) "Line 3"
}
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
file(): Argument #2 ($flags) must be a valid flag value
Function Calls
fopen | 1 |
fwrite | 1 |
Stats
MD5 | a4951b6ca940534e0109f2d5b15974bb |
Eval Count | 0 |
Decode Time | 96 ms |