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-- Bug #75031: Append mode in php://temp and php://memory --FILE-- <?php function t..
Decoded Output download
--TEST--
Bug #75031: Append mode in php://temp and php://memory
--FILE--
<?php
function test_75031($type, $mode) {
$fp = fopen($type, $mode);
fwrite($fp, "hello");
fseek($fp, 0, SEEK_SET);
fwrite($fp, "world");
var_dump(stream_get_contents($fp, -1, 0));
fclose($fp);
}
test_75031("php://temp", "w+");
test_75031("php://memory", "w+");
test_75031("php://temp", "a+");
test_75031("php://memory", "a+");
?>
--EXPECT--
string(5) "world"
string(5) "world"
string(10) "helloworld"
string(10) "helloworld"
Did this file decode correctly?
Original Code
--TEST--
Bug #75031: Append mode in php://temp and php://memory
--FILE--
<?php
function test_75031($type, $mode) {
$fp = fopen($type, $mode);
fwrite($fp, "hello");
fseek($fp, 0, SEEK_SET);
fwrite($fp, "world");
var_dump(stream_get_contents($fp, -1, 0));
fclose($fp);
}
test_75031("php://temp", "w+");
test_75031("php://memory", "w+");
test_75031("php://temp", "a+");
test_75031("php://memory", "a+");
?>
--EXPECT--
string(5) "world"
string(5) "world"
string(10) "helloworld"
string(10) "helloworld"
Function Calls
fopen | 1 |
fwrite | 1 |
test_75031 | 1 |
Stats
MD5 | db3352a9480b1c044d43471ea3e73181 |
Eval Count | 0 |
Decode Time | 81 ms |