File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file / bug44805.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 01:32:06 2013 UTC (11 years ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17, HEAD
5.4.17

--TEST--
Bug#44806 (rename() function is not portable to Windows)
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
    die('skip.. only for Windows');
}
?>
--FILE--
<?php
$dirname = dirname(__FILE__);
$file1 = $dirname . DIRECTORY_SEPARATOR . "file1.txt";
$file2 = $dirname . DIRECTORY_SEPARATOR . "file2.txt";

file_put_contents($file1, "this is file 1");
file_put_contents($file2, "this is file 2");

rename($file1, $file2);

echo "reading file 2: ";
readfile($file2);
if (file_exists($file1)) {
	unlink($file1);
}
if (file_exists($file2)) {
	unlink($file2);
}
?>
--EXPECT--
reading file 2: this is file 1

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>