/usr/share/php/tests/HTTP_Upload/tests/setName.phpt is in php-http-upload 1.0.0b2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | --TEST--
Upload a file and rename it before moving
--UPLOAD--
userfile=files/10b
--FILE--
<?php
require_once 'HTTP/Upload.php';
$up = new HTTP_Upload();
$file = $up->getFiles('userfile');
echo "Valid: "; var_dump($file->isValid());
echo "Missing: "; var_dump($file->isMissing());
echo "Error: "; var_dump($file->isError());
$newname = $file->setName('my10b');
var_dump($newname);
$tmp = sys_get_temp_dir();
$name = $file->moveTo($tmp);
echo 'MoveError: '; var_dump(PEAR::isError($name));
var_dump($name);
var_dump($file->getProp());
var_dump(file_exists($tmp . '/my10b'));
?>
--EXPECTF--
Valid: bool(true)
Missing: bool(false)
Error: bool(false)
string(5) "my10b"
MoveError: bool(false)
string(5) "my10b"
array(8) {
'real' =>
string(3) "10b"
'name' =>
string(5) "my10b"
'form_name' =>
string(8) "userfile"
'ext' =>
NULL
'tmp_name' =>
string(%d) "%s"
'size' =>
int(10)
'type' =>
string(10) "text/plain"
'error' =>
NULL
}
bool(true)
|