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-- Test rename() with a dir for multibyte filenames --SKIPIF-- <?php include __DIR_..
Decoded Output download
--TEST--
Test rename() with a dir for multibyte filenames
--SKIPIF--
<?php
include __DIR__ . DIRECTORY_SEPARATOR . "util.inc";
skip_if_not_win();
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
skip_if_no_required_exts();
?>
--CONFLICTS--
file2_mb
--FILE--
<?php
include __DIR__ . DIRECTORY_SEPARATOR . "util.inc";
$prefix = create_data("file2_mb");
$fw_orig = $prefix . DIRECTORY_SEPARATOR . ".txt";
$fw_copied = $prefix . DIRECTORY_SEPARATOR . "_copy.txt";
$fw_renamed = $prefix . DIRECTORY_SEPARATOR . "17.txt";
$old_cp = get_active_cp();
set_active_cp(65001);
var_dump(copy($fw_orig, $fw_copied));
var_dump(get_basename_with_cp($fw_copied, get_active_cp(), false));
var_dump(file_exists($fw_copied));
var_dump(rename($fw_copied, $fw_renamed));
var_dump(get_basename_with_cp($fw_renamed, get_active_cp(), false));
var_dump(file_exists($fw_renamed));
var_dump(unlink($fw_renamed));
set_active_cp($old_cp);
remove_data("file2_mb");
?>
--EXPECTF--
Active code page: 65001
bool(true)
string(21) "_copy.txt"
bool(true)
bool(true)
string(27) "17.txt"
bool(true)
bool(true)
Active code page: %d
Did this file decode correctly?
Original Code
--TEST--
Test rename() with a dir for multibyte filenames
--SKIPIF--
<?php
include __DIR__ . DIRECTORY_SEPARATOR . "util.inc";
skip_if_not_win();
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
skip_if_no_required_exts();
?>
--CONFLICTS--
file2_mb
--FILE--
<?php
include __DIR__ . DIRECTORY_SEPARATOR . "util.inc";
$prefix = create_data("file2_mb");
$fw_orig = $prefix . DIRECTORY_SEPARATOR . ".txt";
$fw_copied = $prefix . DIRECTORY_SEPARATOR . "_copy.txt";
$fw_renamed = $prefix . DIRECTORY_SEPARATOR . "17.txt";
$old_cp = get_active_cp();
set_active_cp(65001);
var_dump(copy($fw_orig, $fw_copied));
var_dump(get_basename_with_cp($fw_copied, get_active_cp(), false));
var_dump(file_exists($fw_copied));
var_dump(rename($fw_copied, $fw_renamed));
var_dump(get_basename_with_cp($fw_renamed, get_active_cp(), false));
var_dump(file_exists($fw_renamed));
var_dump(unlink($fw_renamed));
set_active_cp($old_cp);
remove_data("file2_mb");
?>
--EXPECTF--
Active code page: 65001
bool(true)
string(21) "_copy.txt"
bool(true)
bool(true)
string(27) "17.txt"
bool(true)
bool(true)
Active code page: %d
Function Calls
None |
Stats
MD5 | 4c5dd8e51acc583b2902b6e9ab2053aa |
Eval Count | 0 |
Decode Time | 87 ms |