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-- Check for eio_seek function basic behaviour --SKIPIF-- --FILE-- <?php ini_set('d..
Decoded Output download
--TEST--
Check for eio_seek function basic behaviour
--SKIPIF--
--FILE--
<?php
ini_set('display_errors', 'On');
ini_set('log_errors', 'Off');
$temp_filename = "eio-temp-file.tmp";
$fp = fopen($temp_filename, "w+");
fwrite($fp, "1234567890");
function my_seek_cb($fp, $result) {
var_dump($result);
if ($result == 0) {
var_dump($fp);
if (is_resource($fp)) {
var_dump(fread($fp, 32));
}
}
}
if (!eio_seek($fp, 6, EIO_SEEK_SET, 0, 'my_seek_cb', $fp)) {
die("Failed to eio_seek");
}
eio_event_loop();
if (!eio_seek($fp, -6, EIO_SEEK_END, 0, 'my_seek_cb', $fp)) {
die("Failed to eio_seek");
}
eio_event_loop();
if (!eio_seek($fp, -100, EIO_SEEK_CUR, 0, 'my_seek_cb', $fp)) {
die("Failed to eio_seek");
}
eio_event_loop();
fclose($fp);
@unlink($temp_filename);
?>
--EXPECTF--
int(0)
resource(5) of type (stream)
string(4) "7890"
int(0)
resource(5) of type (stream)
string(6) "567890"
int(-1)
Did this file decode correctly?
Original Code
--TEST--
Check for eio_seek function basic behaviour
--SKIPIF--
--FILE--
<?php
ini_set('display_errors', 'On');
ini_set('log_errors', 'Off');
$temp_filename = "eio-temp-file.tmp";
$fp = fopen($temp_filename, "w+");
fwrite($fp, "1234567890");
function my_seek_cb($fp, $result) {
var_dump($result);
if ($result == 0) {
var_dump($fp);
if (is_resource($fp)) {
var_dump(fread($fp, 32));
}
}
}
if (!eio_seek($fp, 6, EIO_SEEK_SET, 0, 'my_seek_cb', $fp)) {
die("Failed to eio_seek");
}
eio_event_loop();
if (!eio_seek($fp, -6, EIO_SEEK_END, 0, 'my_seek_cb', $fp)) {
die("Failed to eio_seek");
}
eio_event_loop();
if (!eio_seek($fp, -100, EIO_SEEK_CUR, 0, 'my_seek_cb', $fp)) {
die("Failed to eio_seek");
}
eio_event_loop();
fclose($fp);
@unlink($temp_filename);
?>
--EXPECTF--
int(0)
resource(5) of type (stream)
string(4) "7890"
int(0)
resource(5) of type (stream)
string(6) "567890"
int(-1)
Function Calls
fopen | 1 |
fwrite | 1 |
ini_set | 2 |
Stats
MD5 | 777c1bb977756016dac19483f164fa3c |
Eval Count | 0 |
Decode Time | 99 ms |