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 copy() function: usage variations - src as dir and dest as an existing file(..

Decoded Output download

*** Test copy() function: Trying to copy dir to file ***

Did this file decode correctly?

Original Code

--TEST--
Test copy() function: usage variations - src as dir and dest as an existing file(Bug #42243)
--FILE--
<?php
/* Test copy(): Trying to copy dir to an existing file */

echo "*** Test copy() function: Trying to copy dir to file ***\n";
$file_path = __DIR__;
$file = $file_path."/copy_variation13_dir.tmp";
fclose(fopen($file, "w"));
$dir = $file_path."/copy_variation13";
mkdir($dir);

echo "*** Testing copy() in copying dir to file ***\n";
var_dump( copy($dir, $file) );

var_dump( file_exists($file) );
var_dump( file_exists($dir) );

var_dump( is_file($dir) );
var_dump( is_dir($dir) );

var_dump( is_file($file) );
var_dump( is_dir($file) );

var_dump( filesize($file) );
var_dump( filesize($dir) );

echo "*** Done ***\n";
?>
--CLEAN--
<?php
unlink(__DIR__."/copy_variation13_dir.tmp");
rmdir(__DIR__."/copy_variation13");
?>
--EXPECTF--
*** Test copy() function: Trying to copy dir to file ***
*** Testing copy() in copying dir to file ***

Warning: copy(): The first argument to copy() function cannot be a directory in %scopy_variation13.php on line %d
bool(false)
bool(true)
bool(true)
bool(false)
bool(true)
bool(true)
bool(false)
int(%d)
int(%d)
*** Done ***

Function Calls

None

Variables

None

Stats

MD5 360071c74d3aea0a3a774a89a5eb28eb
Eval Count 0
Decode Time 101 ms