mirror of
https://github.com/php/php-src.git
synced 2026-03-28 10:12:18 +01:00
These files are now split into one or more smaller testcases, hence being deleted.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,145 +0,0 @@
|
||||
--TEST--
|
||||
Test file_get_contents() and file_put_contents() functions : usage variations
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: string file_get_contents( string $filename[, bool $use_include_path[,
|
||||
* resource $context[, int $offset[, int $maxlen]]]] )
|
||||
* Description: Reads entire file into a string
|
||||
*/
|
||||
|
||||
/* Prototype: int file_put_contents( string $filename, mixed $data[,int $flags[, resource $context]] )
|
||||
* Description: Write a string to a file
|
||||
*/
|
||||
|
||||
$file_path = dirname(__FILE__);
|
||||
include($file_path."/file.inc");
|
||||
|
||||
echo "*** Testing with variations in the arguments values ***\n";
|
||||
|
||||
$buffer_types = array("text", "numeric", "text_with_new_line", "alphanumeric");
|
||||
|
||||
foreach( $buffer_types as $type) {
|
||||
fill_buffer($buffer, $type, 100);
|
||||
file_put_contents( $file_path."/file_put_contents.tmp", $buffer);
|
||||
var_dump( file_get_contents($file_path."/file_put_contents.tmp", 0) );
|
||||
var_dump( file_get_contents($file_path."/file_put_contents.tmp", 1) );
|
||||
var_dump( file_get_contents($file_path."/file_put_contents.tmp", 0, NULL, 5) );
|
||||
var_dump( file_get_contents($file_path."/file_put_contents.tmp", 1, NULL, 5) );
|
||||
var_dump( file_get_contents($file_path."/file_put_contents.tmp", 0, NULL, 5, 20) );
|
||||
var_dump( file_get_contents($file_path."/file_put_contents.tmp", 1, NULL, 5, 20) );
|
||||
|
||||
}
|
||||
|
||||
echo "*** Testing with variation in use_include_path argument ***\n";
|
||||
$dir = "file_get_contents";
|
||||
mkdir($file_path."/".$dir);
|
||||
$filename = $file_path."/".$dir."/"."file_get_contents1.tmp";
|
||||
|
||||
ini_set( 'include_path',$file_path."/".$dir );
|
||||
|
||||
$data_array = array( 1, " Data1 in an array", 2, " Data2 in an array" );
|
||||
fill_buffer( $buffer, "text", 100);
|
||||
file_put_contents( $filename, $buffer );
|
||||
fill_buffer( $buffer, "numeric", 100);
|
||||
file_put_contents( $filename, $buffer, FILE_APPEND, NULL );
|
||||
file_put_contents( $filename, $data_array, FILE_APPEND, NULL );
|
||||
var_dump( file_get_contents($filename, 0) );
|
||||
var_dump( file_get_contents($filename, 1) );
|
||||
var_dump( file_get_contents($filename, 0, NULL, 5) );
|
||||
var_dump( file_get_contents($filename, 1, NULL, 5) );
|
||||
var_dump( file_get_contents($filename, 0, NULL, 5, 20) );
|
||||
var_dump( file_get_contents($filename, 1, NULL, 5, 20) );
|
||||
|
||||
echo "--- Done ---";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
//Deleting the temporary files and directory used in the testcase
|
||||
|
||||
$file_path = dirname(__FILE__);
|
||||
unlink($file_path."/file_put_contents.tmp");
|
||||
unlink($file_path."/file_get_contents/file_get_contents1.tmp");
|
||||
rmdir($file_path."/file_get_contents");
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing with variations in the arguments values ***
|
||||
string(100) "text text text text text text text text text text text text text text text text text text text text "
|
||||
string(100) "text text text text text text text text text text text text text text text text text text text text "
|
||||
string(95) "text text text text text text text text text text text text text text text text text text text "
|
||||
string(95) "text text text text text text text text text text text text text text text text text text text "
|
||||
string(20) "text text text text "
|
||||
string(20) "text text text text "
|
||||
string(100) "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
|
||||
string(100) "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
|
||||
string(95) "22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
|
||||
string(95) "22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
|
||||
string(20) "22222222222222222222"
|
||||
string(20) "22222222222222222222"
|
||||
string(100) "line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line "
|
||||
string(100) "line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line "
|
||||
string(95) "line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line "
|
||||
string(95) "line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line of text
|
||||
line
|
||||
line "
|
||||
string(20) "line of text
|
||||
line
|
||||
li"
|
||||
string(20) "line of text
|
||||
line
|
||||
li"
|
||||
string(100) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
|
||||
string(100) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
|
||||
string(95) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
|
||||
string(95) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
|
||||
string(20) "ab12 ab12 ab12 ab12 "
|
||||
string(20) "ab12 ab12 ab12 ab12 "
|
||||
*** Testing with variation in use_include_path argument ***
|
||||
string(240) "text text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
|
||||
string(240) "text text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
|
||||
string(235) "text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
|
||||
string(235) "text text text text text text text text text text text text text text text text text text text 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221 Data1 in an array2 Data2 in an array"
|
||||
string(20) "text text text text "
|
||||
string(20) "text text text text "
|
||||
--- Done ---
|
||||
@@ -1,223 +0,0 @@
|
||||
--TEST--
|
||||
Test filesize() function: usage variations
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die('skip only valid for Windows');
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
Prototype : int filesize ( string $filename );
|
||||
Description : Returns the size of the file in bytes, or FALSE
|
||||
(and generates an error of level E_WARNING) in case of an error.
|
||||
*/
|
||||
|
||||
$file_path = dirname(__FILE__);
|
||||
require($file_path."/file.inc");
|
||||
|
||||
echo "*** Testing filesize(): usage variations ***\n";
|
||||
|
||||
echo "*** Checking filesize() with different size of files ***\n";
|
||||
for($size = 1; $size <10000; $size = $size+1000)
|
||||
{
|
||||
create_files($file_path, 1, "numeric", 0755, $size, "w", "filesize_variation");
|
||||
var_dump( filesize( $file_path."/filesize_variation1.tmp") );
|
||||
clearstatcache();
|
||||
delete_files($file_path, 1, "filesize_variation");
|
||||
}
|
||||
|
||||
echo "\n*** Testing size of a dir, sub-dir and file with filesize() ***\n";
|
||||
echo "-- Creating a base dir, and checking its size --\n";
|
||||
mkdir( $file_path."/filesize_variation");
|
||||
var_dump( filesize( $file_path."/filesize_variation"));
|
||||
clearstatcache();
|
||||
|
||||
echo "-- Creating a file inside base dir, and checking dir & file size --\n";
|
||||
create_files($file_path."/filesize_variation", 1, "numeric", 0755, 1, "w", "filesize_variation");
|
||||
var_dump( filesize( $file_path."/filesize_variation"));
|
||||
clearstatcache();
|
||||
var_dump( filesize( $file_path."/filesize_variation/filesize_variation1.tmp"));
|
||||
clearstatcache();
|
||||
delete_files($file_path."/filesize_variation", 1, "filesize_variation");
|
||||
|
||||
echo "-- Creating an empty sub-dir in base-dir, and checking size of base and sub dir --\n";
|
||||
mkdir( $file_path."/filesize_variation/filesize_variation_sub");
|
||||
var_dump( filesize( $file_path."/filesize_variation")); // size of base dir
|
||||
clearstatcache();
|
||||
var_dump( filesize( $file_path."/filesize_variation/filesize_variation_sub")); // size of subdir
|
||||
clearstatcache();
|
||||
|
||||
echo "-- Creating a file inside sub-dir, and checking size of base, subdir and file created --\n";
|
||||
// create only the file, as base and subdir is already created
|
||||
$filename = $file_path."/filesize_variation/filesize_variation_sub/filesize_variation.tmp";
|
||||
$file_handle = fopen($filename, "w");
|
||||
fwrite($file_handle, str_repeat("Hello,World ", 1000) ); // create file of size 12000 bytes
|
||||
fclose($file_handle);
|
||||
// size of base dir
|
||||
var_dump( filesize( $file_path."/filesize_variation"));
|
||||
clearstatcache();
|
||||
// size of subdir
|
||||
var_dump( filesize( $file_path."/filesize_variation/filesize_variation_sub"));
|
||||
clearstatcache();
|
||||
// size of file inside subdir
|
||||
var_dump( filesize( $file_path."/filesize_variation/filesize_variation_sub/filesize_variation.tmp"));
|
||||
clearstatcache();
|
||||
|
||||
echo "-- Testing filesize() after truncating the file to a new length --\n";
|
||||
// truncate the file created earlier in subdir, the size of the file is 12000bytes
|
||||
// truncate the same file, in the loop , each time with the decrement in size by 1200 bytes,
|
||||
// until -1200bytes size
|
||||
for($size = filesize($filename); $size>=-1200; $size-=1200) {
|
||||
$file_handle = fopen($filename, "r+");
|
||||
var_dump( ftruncate($file_handle, $size) );
|
||||
fclose($file_handle);
|
||||
var_dump( filesize($filename) );
|
||||
clearstatcache();
|
||||
}
|
||||
|
||||
echo "-- Testing filesize() with the data of possible chars --\n";
|
||||
$filename2 = $file_path."/filesize_variation1.tmp";
|
||||
$string = "Test 2 test the filesize() fn, with data containing all the types like !@@##$%^&*():<>?|~+!;',.\][{}(special) chars, 12345(numeric) chars, and \n(newline char), \t(tab), \0, \r and so on........\0";
|
||||
echo "-- opening the file in 'w' mode and get the size --\n";
|
||||
$file_handle = fopen($filename2, "w");
|
||||
var_dump( strlen($string) ); //strlen of the string
|
||||
fwrite($file_handle, $string);
|
||||
fclose($file_handle);
|
||||
var_dump( filesize($filename2) ); //size of the file = strlen of string
|
||||
clearstatcache();
|
||||
|
||||
echo "-- opening the file in 'wt' mode and get the size --\n";
|
||||
$file_handle = fopen($filename2, "wt");
|
||||
var_dump( strlen($string) ); //strlen of the string = 191 bytes
|
||||
fwrite($file_handle, $string);
|
||||
fclose($file_handle);
|
||||
/* '\n' treated as '\r\n' i.e two chars in 'wt' mode */
|
||||
var_dump( filesize($filename2) ); //size of the file = 192 bytes != strlen of string
|
||||
clearstatcache();
|
||||
|
||||
echo "-- opening the file in 'a' mode, adding data and checking the file --\n";
|
||||
$file_handle = fopen($filename2, "a");
|
||||
fwrite($file_handle, "Hello, world");
|
||||
fclose($file_handle);
|
||||
/* '\n' treated as '\r\n' i.e two chars in 'wt' mode */
|
||||
var_dump( filesize($filename2) ); //204 bytes
|
||||
clearstatcache();
|
||||
|
||||
echo "-- opening the file in 'at' mode, adding data and checking the file --\n";
|
||||
$file_handle = fopen($filename2, "at");
|
||||
fwrite($file_handle, "Hello, world\n");
|
||||
fclose($file_handle);
|
||||
/* '\n' treated as '\r\n' i.e two chars in 'wt' mode */
|
||||
var_dump( filesize($filename2) ); //218 bytes
|
||||
clearstatcache();
|
||||
|
||||
echo "-- creating a hole and checking the size --\n";
|
||||
$file_handle = fopen($filename2, "a");
|
||||
var_dump( ftruncate($file_handle, 220) ); //creating 4 bytes of hole
|
||||
fclose($file_handle);
|
||||
var_dump( filesize($filename2) ); //220 bytes
|
||||
clearstatcache();
|
||||
|
||||
echo "-- writing data after hole and checking the size --\n";
|
||||
$file_handle = fopen($filename2, "a");
|
||||
fwrite($file_handle, "Hello\0"); //wrting 6 bytes of data
|
||||
fclose($file_handle);
|
||||
var_dump( filesize($filename2) ); //226 bytes
|
||||
clearstatcache();
|
||||
|
||||
echo "-- opening the existing file in write mode --\n";
|
||||
fclose( fopen($filename2, "w") );
|
||||
var_dump( filesize($filename2) ); //0 bytes
|
||||
clearstatcache();
|
||||
|
||||
echo "-- with empty file --\n";
|
||||
$filename3 = dirname(__FILE__)."/filesize_variation_empty.tmp";
|
||||
fclose( fopen($filename3, "w") );
|
||||
var_dump( filesize($filename3) ); //0 bytes
|
||||
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
$file_path = dirname(__FILE__);
|
||||
rmdir($file_path."/filesize_variation");
|
||||
unlink($file_path."/filesize_variation/filesize_variation_sub/filesize_variation.tmp");
|
||||
rmdir($file_path."/filesize_variation/filesize_variation_sub");
|
||||
rmdir($file_path."/filesize_variation");
|
||||
unlink($file_path."/filesize_variation1.tmp");
|
||||
unlink($file_path."/filesize_variation_empty.tmp");
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing filesize(): usage variations ***
|
||||
*** Checking filesize() with different size of files ***
|
||||
int(1024)
|
||||
int(1025024)
|
||||
int(2049024)
|
||||
int(3073024)
|
||||
int(4097024)
|
||||
int(5121024)
|
||||
int(6145024)
|
||||
int(7169024)
|
||||
int(8193024)
|
||||
int(9217024)
|
||||
|
||||
*** Testing size of a dir, sub-dir and file with filesize() ***
|
||||
-- Creating a base dir, and checking its size --
|
||||
int(0)
|
||||
-- Creating a file inside base dir, and checking dir & file size --
|
||||
int(0)
|
||||
int(1024)
|
||||
-- Creating an empty sub-dir in base-dir, and checking size of base and sub dir --
|
||||
int(0)
|
||||
int(0)
|
||||
-- Creating a file inside sub-dir, and checking size of base, subdir and file created --
|
||||
int(0)
|
||||
int(0)
|
||||
int(12000)
|
||||
-- Testing filesize() after truncating the file to a new length --
|
||||
bool(true)
|
||||
int(12000)
|
||||
bool(true)
|
||||
int(10800)
|
||||
bool(true)
|
||||
int(9600)
|
||||
bool(true)
|
||||
int(8400)
|
||||
bool(true)
|
||||
int(7200)
|
||||
bool(true)
|
||||
int(6000)
|
||||
bool(true)
|
||||
int(4800)
|
||||
bool(true)
|
||||
int(3600)
|
||||
bool(true)
|
||||
int(2400)
|
||||
bool(true)
|
||||
int(1200)
|
||||
bool(true)
|
||||
int(0)
|
||||
bool(false)
|
||||
int(0)
|
||||
-- Testing filesize() with the data of possible chars --
|
||||
-- opening the file in 'w' mode and get the size --
|
||||
int(191)
|
||||
int(191)
|
||||
-- opening the file in 'wt' mode and get the size --
|
||||
int(191)
|
||||
int(192)
|
||||
-- opening the file in 'a' mode, adding data and checking the file --
|
||||
int(204)
|
||||
-- opening the file in 'at' mode, adding data and checking the file --
|
||||
int(218)
|
||||
-- creating a hole and checking the size --
|
||||
bool(true)
|
||||
int(220)
|
||||
-- writing data after hole and checking the size --
|
||||
int(226)
|
||||
-- opening the existing file in write mode --
|
||||
int(0)
|
||||
-- with empty file --
|
||||
int(0)
|
||||
*** Done ***
|
||||
@@ -1,220 +0,0 @@
|
||||
--TEST--
|
||||
Test filesize() function: usage variations
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip only valid for Linux');
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
Prototype : int filesize ( string $filename );
|
||||
Description : Returns the size of the file in bytes, or FALSE
|
||||
(and generates an error of level E_WARNING) in case of an error.
|
||||
*/
|
||||
|
||||
$file_path = dirname(__FILE__);
|
||||
require($file_path."/file.inc");
|
||||
|
||||
echo "*** Testing filesize(): usage variations ***\n";
|
||||
|
||||
echo "*** Checking filesize() with different size of files ***\n";
|
||||
for($size = 1; $size <10000; $size = $size+1000)
|
||||
{
|
||||
create_files($file_path, 1, "numeric", 0755, $size, "w", "filesize_variation");
|
||||
var_dump( filesize( $file_path."/filesize_variation1.tmp") );
|
||||
clearstatcache();
|
||||
delete_files($file_path, 1, "filesize_variation");
|
||||
}
|
||||
|
||||
echo "\n*** Testing size of a dir, sub-dir and file with filesize() ***\n";
|
||||
echo "-- Creating a base dir, and checking its size --\n";
|
||||
mkdir( $file_path."/filesize_variation");
|
||||
var_dump( filesize( $file_path."/filesize_variation"));
|
||||
clearstatcache();
|
||||
|
||||
echo "-- Creating a file inside base dir, and checking dir & file size --\n";
|
||||
create_files($file_path."/filesize_variation", 1, "numeric", 0755, 1, "w", "filesize_variation");
|
||||
var_dump( filesize( $file_path."/filesize_variation"));
|
||||
clearstatcache();
|
||||
var_dump( filesize( $file_path."/filesize_variation/filesize_variation1.tmp"));
|
||||
clearstatcache();
|
||||
delete_files($file_path."/filesize_variation", 1, "filesize_variation");
|
||||
|
||||
echo "-- Creating an empty sub-dir in base-dir, and checking size of base and sub dir --\n";
|
||||
mkdir( $file_path."/filesize_variation/filesize_variation_sub");
|
||||
var_dump( filesize( $file_path."/filesize_variation")); // size of base dir
|
||||
clearstatcache();
|
||||
var_dump( filesize( $file_path."/filesize_variation/filesize_variation_sub")); // size of subdir
|
||||
clearstatcache();
|
||||
|
||||
echo "-- Creating a file inside sub-dir, and checking size of base, subdir and file created --\n";
|
||||
// create only the file, as base and subdir is already created
|
||||
$filename = $file_path."/filesize_variation/filesize_variation_sub/filesize_variation.tmp";
|
||||
$file_handle = fopen($filename, "w");
|
||||
fwrite($file_handle, str_repeat("Hello,World ", 1000) ); // create file of size 12000 bytes
|
||||
fclose($file_handle);
|
||||
// size of base dir
|
||||
var_dump( filesize( $file_path."/filesize_variation"));
|
||||
clearstatcache();
|
||||
// size of subdir
|
||||
var_dump( filesize( $file_path."/filesize_variation/filesize_variation_sub"));
|
||||
clearstatcache();
|
||||
// size of file inside subdir
|
||||
var_dump( filesize( $file_path."/filesize_variation/filesize_variation_sub/filesize_variation.tmp"));
|
||||
clearstatcache();
|
||||
|
||||
echo "-- Testing filesize() after truncating the file to a new length --\n";
|
||||
// truncate the file created earlier in subdir, the size of the file is 12000bytes
|
||||
// truncate the same file, in the loop , each time with the decrement in size by 1200 bytes,
|
||||
// until -1200bytes size
|
||||
for($size = filesize($filename); $size>=-1200; $size-=1200) {
|
||||
$file_handle = fopen($filename, "r+");
|
||||
var_dump( ftruncate($file_handle, $size) );
|
||||
fclose($file_handle);
|
||||
var_dump( filesize($filename) );
|
||||
clearstatcache();
|
||||
}
|
||||
|
||||
echo "-- Testing filesize() with the data of possible chars --\n";
|
||||
$filename2 = $file_path."/filesize_variation1.tmp";
|
||||
$string = "Test 2 test the filesize() fn, with data containing all the types like !@@##$%^&*():<>?|~+!;',.\][{}(special) chars, 12345(numeric) chars, and \n(newline char), \t(tab), \0, \r and so on........\0";
|
||||
echo "-- opening the file in 'w' mode and get the size --\n";
|
||||
$file_handle = fopen($filename2, "w");
|
||||
var_dump( strlen($string) ); //strlen of the string
|
||||
fwrite($file_handle, $string);
|
||||
fclose($file_handle);
|
||||
var_dump( filesize($filename2) ); //size of the file = strlen of string
|
||||
clearstatcache();
|
||||
|
||||
echo "-- opening the file in 'wt' mode and get the size --\n";
|
||||
$file_handle = fopen($filename2, "wt");
|
||||
var_dump( strlen($string) ); //strlen of the string = 191 bytes
|
||||
fwrite($file_handle, $string);
|
||||
fclose($file_handle);
|
||||
var_dump( filesize($filename2) ); //size of the file = strlen of string = 191 bytes
|
||||
clearstatcache();
|
||||
|
||||
echo "-- opening the file in 'a' mode, adding data and checking the file --\n";
|
||||
$file_handle = fopen($filename2, "a");
|
||||
fwrite($file_handle, "Hello, world");
|
||||
fclose($file_handle);
|
||||
var_dump( filesize($filename2) ); //203 bytes
|
||||
clearstatcache();
|
||||
|
||||
echo "-- opening the file in 'at' mode, adding data and checking the file --\n";
|
||||
$file_handle = fopen($filename2, "at");
|
||||
fwrite($file_handle, "Hello, world\n");
|
||||
fclose($file_handle);
|
||||
var_dump( filesize($filename2) ); //216 bytes
|
||||
clearstatcache();
|
||||
|
||||
echo "-- creating a hole and checking the size --\n";
|
||||
$file_handle = fopen($filename2, "a");
|
||||
var_dump( ftruncate($file_handle, 220) ); //creating 4 bytes of hole
|
||||
fclose($file_handle);
|
||||
var_dump( filesize($filename2) ); //220 bytes
|
||||
clearstatcache();
|
||||
|
||||
echo "-- writing data after hole and checking the size --\n";
|
||||
$file_handle = fopen($filename2, "a");
|
||||
fwrite($file_handle, "Hello\0"); //wrting 6 bytes of data
|
||||
fclose($file_handle);
|
||||
var_dump( filesize($filename2) ); //226 bytes
|
||||
clearstatcache();
|
||||
|
||||
echo "-- opening the existing file in write mode --\n";
|
||||
fclose( fopen($filename2, "w") );
|
||||
var_dump( filesize($filename2) ); //0 bytes
|
||||
clearstatcache();
|
||||
|
||||
echo "-- with empty file --\n";
|
||||
$filename3 = dirname(__FILE__)."/filesize_variation_empty.tmp";
|
||||
fclose( fopen($filename3, "w") );
|
||||
var_dump( filesize($filename3) ); //0 bytes
|
||||
|
||||
echo "*** Done ***\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
$file_path = dirname(__FILE__);
|
||||
rmdir($file_path."/filesize_variation");
|
||||
unlink($file_path."/filesize_variation/filesize_variation_sub/filesize_variation.tmp");
|
||||
rmdir($file_path."/filesize_variation/filesize_variation_sub");
|
||||
rmdir($file_path."/filesize_variation");
|
||||
unlink($file_path."/filesize_variation1.tmp");
|
||||
unlink($file_path."/filesize_variation_empty.tmp");
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing filesize(): usage variations ***
|
||||
*** Checking filesize() with different size of files ***
|
||||
int(1024)
|
||||
int(1025024)
|
||||
int(2049024)
|
||||
int(3073024)
|
||||
int(4097024)
|
||||
int(5121024)
|
||||
int(6145024)
|
||||
int(7169024)
|
||||
int(8193024)
|
||||
int(9217024)
|
||||
|
||||
*** Testing size of a dir, sub-dir and file with filesize() ***
|
||||
-- Creating a base dir, and checking its size --
|
||||
int(4096)
|
||||
-- Creating a file inside base dir, and checking dir & file size --
|
||||
int(4096)
|
||||
int(1024)
|
||||
-- Creating an empty sub-dir in base-dir, and checking size of base and sub dir --
|
||||
int(4096)
|
||||
int(4096)
|
||||
-- Creating a file inside sub-dir, and checking size of base, subdir and file created --
|
||||
int(4096)
|
||||
int(4096)
|
||||
int(12000)
|
||||
-- Testing filesize() after truncating the file to a new length --
|
||||
bool(true)
|
||||
int(12000)
|
||||
bool(true)
|
||||
int(10800)
|
||||
bool(true)
|
||||
int(9600)
|
||||
bool(true)
|
||||
int(8400)
|
||||
bool(true)
|
||||
int(7200)
|
||||
bool(true)
|
||||
int(6000)
|
||||
bool(true)
|
||||
int(4800)
|
||||
bool(true)
|
||||
int(3600)
|
||||
bool(true)
|
||||
int(2400)
|
||||
bool(true)
|
||||
int(1200)
|
||||
bool(true)
|
||||
int(0)
|
||||
bool(false)
|
||||
int(0)
|
||||
-- Testing filesize() with the data of possible chars --
|
||||
-- opening the file in 'w' mode and get the size --
|
||||
int(191)
|
||||
int(191)
|
||||
-- opening the file in 'wt' mode and get the size --
|
||||
int(191)
|
||||
int(191)
|
||||
-- opening the file in 'a' mode, adding data and checking the file --
|
||||
int(203)
|
||||
-- opening the file in 'at' mode, adding data and checking the file --
|
||||
int(216)
|
||||
-- creating a hole and checking the size --
|
||||
bool(true)
|
||||
int(220)
|
||||
-- writing data after hole and checking the size --
|
||||
int(226)
|
||||
-- opening the existing file in write mode --
|
||||
int(0)
|
||||
-- with empty file --
|
||||
int(0)
|
||||
*** Done ***
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,200 +0,0 @@
|
||||
--TEST--
|
||||
Test is_executable() function: usage variations
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip.. only for LINUX');
|
||||
}
|
||||
// Skip if being run by root (files are always readable, writeable and executable)
|
||||
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
|
||||
$fp = fopen($filename, 'w');
|
||||
fclose($fp);
|
||||
if(fileowner($filename) == 0) {
|
||||
unlink ($filename);
|
||||
die('skip...cannot be run as root\n');
|
||||
}
|
||||
|
||||
unlink($filename);
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: bool is_executable ( string $filename );
|
||||
Description: Tells whether the filename is executable
|
||||
*/
|
||||
|
||||
require dirname(__FILE__).'/file.inc';
|
||||
echo "*** Testing is_executable(): usage variations ***\n";
|
||||
|
||||
$file_path = dirname(__FILE__);
|
||||
mkdir("$file_path/is_executable");
|
||||
|
||||
// create a new temporary file
|
||||
$fp = fopen("$file_path/is_executable/bar.tmp", "w");
|
||||
fclose($fp);
|
||||
|
||||
/* array of files checked to see if they are executable files
|
||||
using is_executable() function */
|
||||
$files_arr = array(
|
||||
"$file_path/is_executable/bar.tmp",
|
||||
|
||||
/* Testing a file with trailing slash */
|
||||
"$file_path/is_executable/bar.tmp/",
|
||||
|
||||
/* Testing file with double slashes */
|
||||
"$file_path/is_executable//bar.tmp",
|
||||
"$file_path/is_executable/*.tmp",
|
||||
"$file_path/is_executable/b*.tmp",
|
||||
|
||||
/* Testing Binary safe */
|
||||
"$file_path/is_executable".chr(0)."bar.temp",
|
||||
"$file_path".chr(0)."is_executable/bar.temp",
|
||||
"$file_path/is_executablex000/",
|
||||
|
||||
/* Testing directories */
|
||||
".", // current directory, exp: bool(true)
|
||||
"$file_path/is_executable" // temp directory, exp: bool(true)
|
||||
);
|
||||
$counter = 1;
|
||||
/* loop through to test each element in the above array
|
||||
is an executable file */
|
||||
foreach($files_arr as $file) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
var_dump( is_executable($file) );
|
||||
$counter++;
|
||||
clearstatcache();
|
||||
}
|
||||
|
||||
echo "\n*** Testing is_executable() on directory without execute permission ***\n";
|
||||
chmod("$file_path/is_executable", 0444);
|
||||
var_dump( is_executable("$file_path/is_executable") ); // exp: bool(false)
|
||||
chmod("$file_path/is_executable", 0777); // chmod to enable deletion of directory
|
||||
|
||||
echo "\n*** Testing miscelleneous input for is_executable() function ***\n";
|
||||
$name_prefix = "is_executable";
|
||||
create_files(dirname(__FILE__), 1, "numeric", 0755, 1, "w", $name_prefix, 1);
|
||||
create_files(dirname(__FILE__), 1, "text", 0755, 1, "w", $name_prefix, 2);
|
||||
create_files(dirname(__FILE__), 1, "empty", 0755, 1, "w", $name_prefix, 3);
|
||||
create_files(dirname(__FILE__), 1, "numeric", 0755, 1, "w", $name_prefix, 4);
|
||||
create_files(dirname(__FILE__), 1, "text", 0222, 1, "w", $name_prefix, 5);
|
||||
create_files(dirname(__FILE__), 1, "numeric", 0711, 1, "w", $name_prefix, 6);
|
||||
create_files(dirname(__FILE__), 1, "text", 0714, 1, "w", $name_prefix, 7);
|
||||
create_files(dirname(__FILE__), 1, "numeric", 0744, 1, "w", $name_prefix, 8);
|
||||
create_files(dirname(__FILE__), 1, "text", 0421, 1, "w", $name_prefix, 9);
|
||||
create_files(dirname(__FILE__), 1, "text", 0712, 1, "w", $name_prefix, 10);
|
||||
|
||||
$files = array (
|
||||
"$file_path/is_executable1.tmp",
|
||||
"$file_path/is_executable2.tmp",
|
||||
"$file_path/is_executable3.tmp",
|
||||
"$file_path/is_executable4.tmp",
|
||||
"$file_path/is_executable5.tmp",
|
||||
"$file_path/is_executable6.tmp",
|
||||
"$file_path/is_executable7.tmp",
|
||||
"$file_path/is_executable8.tmp",
|
||||
"$file_path/is_executable9.tmp",
|
||||
"$file_path/is_executable10.tmp",
|
||||
);
|
||||
$counter = 1;
|
||||
/* loop through to test each element in the above array
|
||||
is an executable file */
|
||||
foreach($files as $file) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
var_dump( is_executable($file) );
|
||||
$counter++;
|
||||
clearstatcache();
|
||||
}
|
||||
|
||||
// change all file's permissions to 777 before deleting
|
||||
change_file_perms($file_path, 10, 0777, $name_prefix);
|
||||
delete_files($file_path, 10, $name_prefix);
|
||||
|
||||
$file_handle = fopen(__FILE__, "r");
|
||||
unset($file_handle);
|
||||
|
||||
echo "\n*** Testing is_executable() on invalid files ***\n";
|
||||
$invalid_files = array(
|
||||
0,
|
||||
1234,
|
||||
-2.34555,
|
||||
"string",
|
||||
TRUE,
|
||||
FALSE,
|
||||
NULL,
|
||||
@array(),
|
||||
@$file_handle
|
||||
);
|
||||
/* loop through to test each element in the above array
|
||||
is an executable file */
|
||||
foreach( $invalid_files as $invalid_file ) {
|
||||
var_dump( is_executable($invalid_file) );
|
||||
clearstatcache();
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(dirname(__FILE__)."/is_executable/bar.tmp");
|
||||
rmdir(dirname(__FILE__)."/is_executable/");
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing is_executable(): usage variations ***
|
||||
-- Iteration 1 --
|
||||
bool(false)
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
-- Iteration 8 --
|
||||
bool(false)
|
||||
-- Iteration 9 --
|
||||
bool(true)
|
||||
-- Iteration 10 --
|
||||
bool(true)
|
||||
|
||||
*** Testing is_executable() on directory without execute permission ***
|
||||
bool(false)
|
||||
|
||||
*** Testing miscelleneous input for is_executable() function ***
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
-- Iteration 8 --
|
||||
bool(true)
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
-- Iteration 10 --
|
||||
bool(true)
|
||||
|
||||
*** Testing is_executable() on invalid files ***
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,203 +0,0 @@
|
||||
--TEST--
|
||||
Test is_readable() function: usage variations
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip.. only for LINUX');
|
||||
}
|
||||
// Skip if being run by root (files are always readable, writeable and executable)
|
||||
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
|
||||
$fp = fopen($filename, 'w');
|
||||
fclose($fp);
|
||||
if(fileowner($filename) == 0) {
|
||||
unlink ($filename);
|
||||
die('skip...cannot be run as root\n');
|
||||
}
|
||||
|
||||
unlink($filename);
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: bool is_readable ( string $filename );
|
||||
Description: Tells whether the filename is readable.
|
||||
*/
|
||||
|
||||
require dirname(__FILE__).'/file.inc';
|
||||
echo "*** Testing is_readable(): usage variations ***\n";
|
||||
|
||||
$file_path = dirname(__FILE__);
|
||||
mkdir("$file_path/is_readable");
|
||||
|
||||
// create a new temporary file
|
||||
$fp = fopen("$file_path/is_readable/bar.tmp", "w");
|
||||
fclose($fp);
|
||||
|
||||
/* array of files to be tested if they are readable by using
|
||||
is_readable() function */
|
||||
$files_arr = array(
|
||||
"$file_path/is_readable/bar.tmp",
|
||||
|
||||
/* Testing a file trailing slash */
|
||||
"$file_path/is_readable/bar.tmp/",
|
||||
|
||||
/* Testing file with double slashes */
|
||||
"$file_path/is_readable//bar.tmp",
|
||||
"$file_path//is_readable//bar.tmp",
|
||||
"$file_path/is_readable/*.tmp",
|
||||
"$file_path/is_readable/b*.tmp",
|
||||
|
||||
/* Testing Binary safe */
|
||||
"$file_path/is_readable".chr(0)."bar.tmp",
|
||||
"$file_path".chr(0)."is_readable/bar.tmp",
|
||||
"$file_path".chr(0)."is_readable/bar.tmp",
|
||||
|
||||
/* Testing directories */
|
||||
".", // current directory, exp: bool(true)
|
||||
"$file_path/is_readable" // temp directory, exp: bool(true)
|
||||
);
|
||||
$counter = 1;
|
||||
/* loop through to test each element in the above array
|
||||
is a writable file */
|
||||
foreach($files_arr as $file) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
var_dump( is_readable($file) );
|
||||
$counter++;
|
||||
clearstatcache();
|
||||
}
|
||||
|
||||
echo "\n*** Testing is_readable() on directory without read permission ***\n";
|
||||
chmod("$file_path/is_readable", 0001);
|
||||
var_dump( is_readable("$file_path/is_readable") ); // exp: bool(false)
|
||||
chmod("$file_path/is_readable", 0777); // chmod to enable deletion of directory
|
||||
|
||||
echo "\n*** Testing miscelleneous input for is_readable() function ***\n";
|
||||
$name_prefix = "is_readable";
|
||||
create_files(dirname(__FILE__), 1, "numeric", 0755, 1, "w", $name_prefix, 1);
|
||||
create_files(dirname(__FILE__), 1, "text", 0755, 1, "w", $name_prefix, 2);
|
||||
create_files(dirname(__FILE__), 1, "empty", 0755, 1, "w", $name_prefix, 3);
|
||||
create_files(dirname(__FILE__), 1, "numeric", 0555, 1, "w", $name_prefix, 4);
|
||||
create_files(dirname(__FILE__), 1, "text", 0222, 1, "w", $name_prefix, 5);
|
||||
create_files(dirname(__FILE__), 1, "numeric", 0711, 1, "w", $name_prefix, 6);
|
||||
create_files(dirname(__FILE__), 1, "text", 0411, 1, "w", $name_prefix, 7);
|
||||
create_files(dirname(__FILE__), 1, "numeric", 0444, 1, "w", $name_prefix, 8);
|
||||
create_files(dirname(__FILE__), 1, "text", 0421, 1, "w", $name_prefix, 9);
|
||||
create_files(dirname(__FILE__), 1, "text", 0422, 1, "w", $name_prefix, 10);
|
||||
|
||||
$files = array (
|
||||
"$file_path/is_readable1.tmp",
|
||||
"$file_path/is_readable2.tmp",
|
||||
"$file_path/is_readable3.tmp",
|
||||
"$file_path/is_readable4.tmp",
|
||||
"$file_path/is_readable5.tmp",
|
||||
"$file_path/is_readable6.tmp",
|
||||
"$file_path/is_readable7.tmp",
|
||||
"$file_path/is_readable8.tmp",
|
||||
"$file_path/is_readable9.tmp",
|
||||
"$file_path/is_readable10.tmp"
|
||||
);
|
||||
$counter = 1;
|
||||
/* loop through to test each element in the above array
|
||||
is a readable file */
|
||||
foreach($files as $file) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
var_dump( is_readable($file) );
|
||||
$counter++;
|
||||
clearstatcache();
|
||||
}
|
||||
|
||||
// change all file's permissions to 777 before deleting
|
||||
change_file_perms($file_path, 10, 0777, $name_prefix);
|
||||
delete_files($file_path, 10, $name_prefix);
|
||||
|
||||
$file_handle = fopen(__FILE__, "r");
|
||||
unset($file_handle);
|
||||
|
||||
echo "\n*** Testing is_readable() on miscelleneous filenames ***\n";
|
||||
$misc_files = array(
|
||||
0,
|
||||
1234,
|
||||
-2.34555,
|
||||
"string",
|
||||
TRUE,
|
||||
FALSE,
|
||||
NULL,
|
||||
@array(),
|
||||
@$file_handle
|
||||
);
|
||||
/* loop through to test each element in the above array
|
||||
is a readable file */
|
||||
foreach( $misc_files as $misc_file ) {
|
||||
var_dump( is_readable($misc_file) );
|
||||
clearstatcache();
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(dirname(__FILE__)."/is_readable/bar.tmp");
|
||||
rmdir(dirname(__FILE__)."/is_readable/");
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing is_readable(): usage variations ***
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
-- Iteration 8 --
|
||||
bool(true)
|
||||
-- Iteration 9 --
|
||||
bool(true)
|
||||
-- Iteration 10 --
|
||||
bool(true)
|
||||
-- Iteration 11 --
|
||||
bool(true)
|
||||
|
||||
*** Testing is_readable() on directory without read permission ***
|
||||
bool(false)
|
||||
|
||||
*** Testing miscelleneous input for is_readable() function ***
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
-- Iteration 8 --
|
||||
bool(true)
|
||||
-- Iteration 9 --
|
||||
bool(true)
|
||||
-- Iteration 10 --
|
||||
bool(true)
|
||||
|
||||
*** Testing is_readable() on miscelleneous filenames ***
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,244 +0,0 @@
|
||||
--TEST--
|
||||
Test is_writable() and its alias is_writeable() function: usage variations
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip.. only on LINUX');
|
||||
}
|
||||
// Skip if being run by root (files are always readable, writeable and executable)
|
||||
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
|
||||
$fp = fopen($filename, 'w');
|
||||
fclose($fp);
|
||||
if(fileowner($filename) == 0) {
|
||||
unlink ($filename);
|
||||
die('skip...cannot be run as root\n');
|
||||
}
|
||||
|
||||
unlink($filename);
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: bool is_writable ( string $filename );
|
||||
Description: Tells whether the filename is writable.
|
||||
|
||||
is_writeable() is an alias of is_writable()
|
||||
*/
|
||||
|
||||
require dirname(__FILE__).'/file.inc';
|
||||
echo "*** Testing is_writable(): usage variations ***\n";
|
||||
|
||||
$file_path = dirname(__FILE__);
|
||||
mkdir("$file_path/is_writable");
|
||||
|
||||
// create a new temporary file
|
||||
$fp = fopen("$file_path/is_writable/bar.tmp", "w");
|
||||
fclose($fp);
|
||||
|
||||
/* array of files to be tested to check if they are writable
|
||||
using is_writable() function */
|
||||
$files_arr = array(
|
||||
"$file_path/is_writable/bar.tmp",
|
||||
|
||||
/* Testing a file trailing slash */
|
||||
"$file_path/is_writable/bar.tmp/",
|
||||
|
||||
/* Testing file with double slashes */
|
||||
"$file_path/is_writable//bar.tmp",
|
||||
"$file_path//is_writable//bar.tmp",
|
||||
"$file_path/is_writable/*.tmp",
|
||||
"$file_path/is_writable/b*.tmp",
|
||||
|
||||
/* Testing Binary safe */
|
||||
"$file_path/is_writable".chr(0)."bar.tmp",
|
||||
"$file_path".chr(0)."is_writable/bar.tmp",
|
||||
"$file_path".chr(0)."is_writable/bar.tmp",
|
||||
|
||||
/* Testing directories */
|
||||
".", // current directory, exp: bool(true)
|
||||
"$file_path/is_writable" // temp directory, exp: bool(true)
|
||||
);
|
||||
$counter = 1;
|
||||
/* loop through to test each element in the above array
|
||||
is a writable file */
|
||||
foreach($files_arr as $file) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
var_dump( is_writable($file) );
|
||||
var_dump( is_writeable($file) );
|
||||
$counter++;
|
||||
clearstatcache();
|
||||
}
|
||||
|
||||
echo "\n*** Testing is_writable() on directory without write permission ***\n";
|
||||
chmod("$file_path/is_writable", 0004);
|
||||
var_dump( is_writable("$file_path/is_writable") ); // exp: bool(false)
|
||||
var_dump( is_writeable("$file_path/is_writable") ); // exp: bool(false)
|
||||
chmod("$file_path/is_writable", 0777); // chmod to enable deletion of directory
|
||||
|
||||
echo "\n*** Testing miscelleneous input for is_writable() function ***\n";
|
||||
$name_prefix = "is_writable";
|
||||
create_files(dirname(__FILE__), 1, "numeric", 0755, 1, "w", $name_prefix, 1);
|
||||
create_files(dirname(__FILE__), 1, "text", 0755, 1, "w", $name_prefix, 2);
|
||||
create_files(dirname(__FILE__), 1, "empty", 0755, 1, "w", $name_prefix, 3);
|
||||
create_files(dirname(__FILE__), 1, "numeric", 0555, 1, "w", $name_prefix, 4);
|
||||
create_files(dirname(__FILE__), 1, "text", 0222, 1, "w", $name_prefix, 5);
|
||||
create_files(dirname(__FILE__), 1, "numeric", 0711, 1, "w", $name_prefix, 6);
|
||||
create_files(dirname(__FILE__), 1, "text", 0114, 1, "w", $name_prefix, 7);
|
||||
create_files(dirname(__FILE__), 1, "numeric", 0244, 1, "w", $name_prefix, 8);
|
||||
create_files(dirname(__FILE__), 1, "text", 0421, 1, "w", $name_prefix, 9);
|
||||
create_files(dirname(__FILE__), 1, "text", 0422, 1, "w", $name_prefix, 10);
|
||||
|
||||
$misc_files = array (
|
||||
"$file_path/is_writable1.tmp",
|
||||
"$file_path/is_writable2.tmp",
|
||||
"$file_path/is_writable3.tmp",
|
||||
"$file_path/is_writable4.tmp",
|
||||
"$file_path/is_writable5.tmp",
|
||||
"$file_path/is_writable6.tmp",
|
||||
"$file_path/is_writable7.tmp",
|
||||
"$file_path/is_writable8.tmp",
|
||||
"$file_path/is_writable9.tmp",
|
||||
"$file_path/is_writable10.tmp"
|
||||
);
|
||||
|
||||
$counter = 1;
|
||||
/* loop through to test each element in the above array
|
||||
is a writable file */
|
||||
foreach($misc_files as $misc_file) {
|
||||
echo "-- Iteration $counter --\n";
|
||||
var_dump( is_writable($misc_file) );
|
||||
var_dump( is_writeable($misc_file) );
|
||||
$counter++;
|
||||
clearstatcache();
|
||||
}
|
||||
|
||||
// change all file's permissions to 777 before deleting
|
||||
change_file_perms($file_path, 10, 0777, $name_prefix);
|
||||
delete_files($file_path, 10, $name_prefix);
|
||||
|
||||
$file_handle = fopen(__FILE__, "r");
|
||||
unset($file_handle);
|
||||
|
||||
clearstatcache();
|
||||
echo "\n*** Testing is_writable() on miscelleneous filenames ***\n";
|
||||
$misc_files = array(
|
||||
0,
|
||||
1234,
|
||||
-2.34555,
|
||||
"string",
|
||||
TRUE,
|
||||
FALSE,
|
||||
NULL,
|
||||
@array(),
|
||||
@$file_handle
|
||||
);
|
||||
/* loop through to test each element in the above array
|
||||
is a writable file */
|
||||
foreach( $misc_files as $misc_file ) {
|
||||
var_dump( is_writable($misc_file) );
|
||||
var_dump( is_writeable($misc_file) );
|
||||
clearstatcache();
|
||||
}
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(dirname(__FILE__)."/is_writable/bar.tmp");
|
||||
rmdir(dirname(__FILE__)."/is_writable/");
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing is_writable(): usage variations ***
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- Iteration 5 --
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- Iteration 7 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- Iteration 8 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- Iteration 9 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- Iteration 10 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- Iteration 11 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
*** Testing is_writable() on directory without write permission ***
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
*** Testing miscelleneous input for is_writable() function ***
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- Iteration 3 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- Iteration 5 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- Iteration 6 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- Iteration 8 --
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
*** Testing is_writable() on miscelleneous filenames ***
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Notice: Array to string conversion in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,165 +0,0 @@
|
||||
--TEST--
|
||||
Test symlink(), linkinfo(), link() and is_link() functions: basic functionality
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip no symlinks on Windows');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: bool symlink ( string $target, string $link );
|
||||
Description: creates a symbolic link to the existing target with the specified name link
|
||||
|
||||
Prototype: bool is_link ( string $filename );
|
||||
Description: Tells whether the given file is a symbolic link.
|
||||
|
||||
Prototype: bool link ( string $target, string $link );
|
||||
Description: Create a hard link
|
||||
|
||||
Prototype: int linkinfo ( string $path );
|
||||
Description: Gets information about a link
|
||||
*/
|
||||
|
||||
$file_path = dirname(__FILE__);
|
||||
|
||||
// temp dir created in present working directory
|
||||
$dirname = "symlink_linkinfo_link_is_link";
|
||||
mkdir("$file_path/$dirname"); // creating temp dir
|
||||
|
||||
/* Creating soft/hard link to $filename created in temp directory $dirname
|
||||
and checking linkinfo() and is_link() on the link created */
|
||||
|
||||
echo "*** Testing symlink(), linkinfo(), link() and is_link() : basic functionality ***\n";
|
||||
|
||||
// creating file in $dirname, links are created to the this file
|
||||
$filename = "$file_path/$dirname/symlink_is_link_linkinfo_link.tmp";
|
||||
$filename = fopen($filename, "w");
|
||||
fclose($filename);
|
||||
|
||||
// name of the soft link created to $filename
|
||||
$sym_linkname = "$file_path/$dirname/symlink_linkinfo_link_is_link_softlink.tmp";
|
||||
|
||||
// name of the hard link created to $filename
|
||||
$linkname = "$file_path/$dirname/symlink_linkinfo_link_is_link_hardlink.tmp";
|
||||
|
||||
// filename stored in array with single and double slash notation in its path
|
||||
$files = array (
|
||||
"$file_path/$dirname/symlink_is_link_linkinfo_link.tmp",
|
||||
"$file_path//$dirname//symlink_is_link_linkinfo_link.tmp"
|
||||
);
|
||||
|
||||
$counter = 1;
|
||||
/* create soft/hard link to the file
|
||||
and check linkinfo() and is_link() on the link created */
|
||||
foreach($files as $file) {
|
||||
echo "\n-- Iteration $counter --\n";
|
||||
echo "-- Testing on soft links --\n";
|
||||
// create soft link
|
||||
var_dump( symlink($file, $sym_linkname) );
|
||||
// checking information of link with linkinfo()
|
||||
var_dump( linkinfo($sym_linkname) );
|
||||
// checking if given file is soft link
|
||||
var_dump( is_link($sym_linkname) );
|
||||
// clear the cache
|
||||
clearstatcache();
|
||||
|
||||
// testing on hard link
|
||||
echo "-- Testing on hard links --\n";
|
||||
// creating hard link
|
||||
var_dump( link($file, $linkname) );
|
||||
// checking information of link with linkinfo()
|
||||
var_dump( linkinfo($linkname) );
|
||||
// checking if given link is soft link; expected: false
|
||||
var_dump( is_link($linkname) );
|
||||
// clear the cache
|
||||
clearstatcache();
|
||||
|
||||
// deleting the links
|
||||
unlink($sym_linkname);
|
||||
unlink($linkname);
|
||||
$counter++;
|
||||
}
|
||||
|
||||
/* Creating soft/hard link to the temporary dir $dirname and checking
|
||||
linkinfo() and is_link() on the link created to $dirname */
|
||||
|
||||
$dirname = "symlink_linkinfo_link_is_link";
|
||||
echo "\n*** Testing symlink(), linkinfo(), link() and is_link() on directory ***\n";
|
||||
|
||||
// name of the soft link created to $dirname
|
||||
$sym_linkname = "$file_path/$dirname/symlink_linkinfo_link_is_link_softlink.tmp";
|
||||
|
||||
// name of the hard link created to $dirname
|
||||
$linkname = "$file_path/$dirname/symlink_linkinfo_link_is_link_hardlink.tmp";
|
||||
|
||||
// testing on soft link
|
||||
echo "\n-- Testing on soft links --\n";
|
||||
// creating soft link to $dirname
|
||||
var_dump( symlink("$file_path/$dirname", $sym_linkname) ); // this works, expected true
|
||||
// gets information about soft link created to directory; expected: true
|
||||
var_dump( linkinfo($sym_linkname) );
|
||||
// checks if link created is soft link; expected: true
|
||||
var_dump( is_link($sym_linkname) );
|
||||
// clear the cache
|
||||
clearstatcache();
|
||||
|
||||
// testing on hard link
|
||||
echo "\n-- Testing on hard links --\n";
|
||||
// creating hard link to $dirname; expected: false
|
||||
var_dump( link("$file_path/$dirname", $linkname) ); // this doesn't work, expected false
|
||||
var_dump( linkinfo($linkname) ); // link doesn't exists as not created, expected false
|
||||
var_dump( is_link($linkname) ); // link doesn't exists as not created, expected false
|
||||
// clear the cache
|
||||
clearstatcache();
|
||||
|
||||
// deleting the links
|
||||
unlink($sym_linkname);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
$dirname = dirname(__FILE__)."/symlink_linkinfo_link_is_link";
|
||||
unlink("$dirname/symlink_is_link_linkinfo_link.tmp");
|
||||
rmdir($dirname);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing symlink(), linkinfo(), link() and is_link() : basic functionality ***
|
||||
|
||||
-- Iteration 1 --
|
||||
-- Testing on soft links --
|
||||
bool(true)
|
||||
int(%d)
|
||||
bool(true)
|
||||
-- Testing on hard links --
|
||||
bool(true)
|
||||
int(%d)
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
-- Testing on soft links --
|
||||
bool(true)
|
||||
int(%d)
|
||||
bool(true)
|
||||
-- Testing on hard links --
|
||||
bool(true)
|
||||
int(%d)
|
||||
bool(false)
|
||||
|
||||
*** Testing symlink(), linkinfo(), link() and is_link() on directory ***
|
||||
|
||||
-- Testing on soft links --
|
||||
bool(true)
|
||||
int(%d)
|
||||
bool(true)
|
||||
|
||||
-- Testing on hard links --
|
||||
|
||||
Warning: link(): Operation not permitted in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: linkinfo(): No such file or directory in %s on line %d
|
||||
int(-1)
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,171 +0,0 @@
|
||||
--TEST--
|
||||
Test symlink(), linkinfo(), link() and is_link() functions : error conditions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip no symlinks on Windows');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: bool symlink ( string $target, string $link );
|
||||
Description: creates a symbolic link to the existing target with the specified name link
|
||||
|
||||
Prototype: bool is_link ( string $filename );
|
||||
Description: Tells whether the given file is a symbolic link.
|
||||
|
||||
Prototype: bool link ( string $target, string $link );
|
||||
Description: Create a hard link
|
||||
|
||||
Prototype: int linkinfo ( string $path );
|
||||
Description: Gets information about a link
|
||||
*/
|
||||
|
||||
// create temp $filename and create link $linkname to it
|
||||
$filename = dirname(__FILE__)."/symlink_link_linkinfo_is_link.tmp";
|
||||
$fp = fopen($filename, "w"); // create temp file
|
||||
fclose($fp);
|
||||
|
||||
// linkname used to create soft/hard link
|
||||
$linkname = dirname(__FILE__)."/symlink_link_linkinfo_is_link_link.tmp";
|
||||
|
||||
echo "*** Testing symlink() for error conditions ***\n";
|
||||
//zero arguments
|
||||
var_dump( symlink() );
|
||||
|
||||
//more than expected
|
||||
var_dump( symlink($filename, $linkname, true) );
|
||||
|
||||
//invalid arguments
|
||||
var_dump( symlink(NULL, $linkname) ); // NULL as filename
|
||||
var_dump( symlink('', $linkname) ); // empty string as filename
|
||||
var_dump( symlink(false, $linkname) ); // boolean false as filename
|
||||
var_dump( symlink($filename, NULL) ); // NULL as linkname
|
||||
var_dump( symlink($filename, '') ); // '' as linkname
|
||||
var_dump( symlink($filename, false) ); // false as linkname
|
||||
|
||||
echo "\n*** Testing linkinfo() for error conditions ***\n";
|
||||
//zero arguments
|
||||
var_dump( linkinfo() );
|
||||
|
||||
//more than expected
|
||||
var_dump( linkinfo($linkname, true) );
|
||||
|
||||
//invalid arguments
|
||||
var_dump( linkinfo(NULL) ); // NULL as linkname
|
||||
var_dump( linkinfo('') ); // empty string as linkname
|
||||
var_dump( linkinfo(false) ); // boolean false as linkname
|
||||
|
||||
echo "\n*** Testing link() for error conditions ***\n";
|
||||
//zero arguments
|
||||
var_dump( link() );
|
||||
|
||||
//more than expected
|
||||
var_dump( link($filename, $linkname, false) );
|
||||
|
||||
//invalid arguments
|
||||
var_dump( link(NULL, $linkname) ); // NULL as filename
|
||||
var_dump( link('', $linkname) ); // empty string as filename
|
||||
var_dump( link(false, $linkname) ); // boolean false as filename
|
||||
var_dump( link($filename, NULL) ); // NULL as linkname
|
||||
var_dump( link($filename, '') ); // '' as linkname
|
||||
var_dump( link($filename, false) ); // false as linkname
|
||||
|
||||
echo "\n*** Testing is_link() for error conditions ***\n";
|
||||
//zero arguments
|
||||
var_dump( is_link() );
|
||||
|
||||
//more than expected
|
||||
var_dump( is_link($linkname, "/") );
|
||||
|
||||
//invalid arguments
|
||||
var_dump( is_link(NULL) ); // NULL as linkname
|
||||
var_dump( is_link('') ); // empty string as linkname
|
||||
var_dump( is_link(false) ); // boolean false as linkname
|
||||
var_dump( is_link($filename) ); // file given to is_link
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(dirname(__FILE__)."/symlink_link_linkinfo_is_link.tmp");
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing symlink() for error conditions ***
|
||||
|
||||
Warning: Wrong parameter count for symlink() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for symlink() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: symlink(): No such file or directory in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: symlink(): No such file or directory in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: symlink(): No such file or directory in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: symlink(): No such file or directory in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: symlink(): No such file or directory in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: symlink(): No such file or directory in %s on line %d
|
||||
bool(false)
|
||||
|
||||
*** Testing linkinfo() for error conditions ***
|
||||
|
||||
Warning: Wrong parameter count for linkinfo() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for linkinfo() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: linkinfo(): No such file or directory in %s on line %d
|
||||
int(-1)
|
||||
|
||||
Warning: linkinfo(): No such file or directory in %s on line %d
|
||||
int(-1)
|
||||
|
||||
*** Testing link() for error conditions ***
|
||||
|
||||
Warning: Wrong parameter count for link() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for link() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: link(): No such file or directory in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: link(): No such file or directory in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: link(): No such file or directory in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: link(): No such file or directory in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: link(): No such file or directory in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: link(): No such file or directory in %s on line %d
|
||||
bool(false)
|
||||
|
||||
*** Testing is_link() for error conditions ***
|
||||
|
||||
Warning: Wrong parameter count for is_link() in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: Wrong parameter count for is_link() in %s on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
Done
|
||||
@@ -1,773 +0,0 @@
|
||||
--TEST--
|
||||
Test symlink(), linkinfo(), link() and is_link() functions : usage variations
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip no symlinks on Windows');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: bool symlink ( string $target, string $link );
|
||||
Description: creates a symbolic link to the existing target with the specified name link
|
||||
|
||||
Prototype: bool is_link ( string $filename );
|
||||
Description: Tells whether the given file is a symbolic link.
|
||||
|
||||
Prototype: bool link ( string $target, string $link );
|
||||
Description: Create a hard link
|
||||
|
||||
Prototype: int linkinfo ( string $path );
|
||||
Description: Gets information about a link
|
||||
*/
|
||||
|
||||
// creating temp directory which will contain temp file and links created
|
||||
$file_path = dirname(__FILE__);
|
||||
$dirname = "$file_path/symlink_link_linkinfo_is_link/test/home";
|
||||
mkdir($dirname, 0777, true);
|
||||
|
||||
// creating temp file; links are created to this file later on
|
||||
$filename = "$file_path/symlink_link_linkinfo_is_link/symlink_link_linkinfo_is_link.tmp";
|
||||
$fp = fopen($filename, "w");
|
||||
fclose($fp);
|
||||
|
||||
/* Variation 1 : Creating links across directories where linkname is stored as an object and array member */
|
||||
echo "*** Testing symlink(), link(), linkinfo() and is_link() with linknames stored as members in an object ***\n";
|
||||
class object_temp {
|
||||
var $linkname;
|
||||
function object_temp($link) {
|
||||
$this->linkname = $link;
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new object_temp("$dirname/symlink_link_linkinfo_is_link_link.tmp");
|
||||
/* Testing on soft links */
|
||||
echo "\n-- Working with soft links --\n";
|
||||
// creating soft link
|
||||
var_dump( symlink($filename, $obj->linkname) );
|
||||
// check if the link exists
|
||||
var_dump( linkinfo($obj->linkname) );
|
||||
// check if link is soft link
|
||||
var_dump( is_link($obj->linkname) );
|
||||
// delete the link created
|
||||
unlink($obj->linkname);
|
||||
// clear the cache
|
||||
clearstatcache();
|
||||
|
||||
/* Testing on hard links */
|
||||
echo "\n-- Working with hard links --\n";
|
||||
// creating hard link
|
||||
var_dump( link($filename, $obj->linkname) );
|
||||
// check if the link exists
|
||||
var_dump( linkinfo($obj->linkname) );
|
||||
// check if link is soft link; expected: false as the link is a hardlink
|
||||
var_dump( is_link($obj->linkname) );
|
||||
// delete the link created
|
||||
unlink($obj->linkname);
|
||||
// clear the cache
|
||||
clearstatcache();
|
||||
|
||||
echo "\n*** Testing symlink(), link(), linkinfo() and is_link() with linknames stored as members of an array ***\n";
|
||||
|
||||
$link_arr = array("$dirname/symlink_link_linkinfo_is_link_link.tmp");
|
||||
|
||||
/* Testing on soft links */
|
||||
echo "\n-- Working with soft links --\n";
|
||||
// creating soft link
|
||||
var_dump( symlink($filename, $link_arr[0]) );
|
||||
// check if the link exist
|
||||
var_dump( linkinfo($link_arr[0]) );
|
||||
// check if link is soft link
|
||||
var_dump( is_link($link_arr[0]) );
|
||||
// delete the link created
|
||||
unlink($link_arr[0]);
|
||||
// clear the cache
|
||||
clearstatcache();
|
||||
|
||||
/* Testing on hard links */
|
||||
echo "\n-- Working with hard links --\n";
|
||||
// creating hard link
|
||||
var_dump( link($filename, $link_arr[0]) );
|
||||
// check if the link exist
|
||||
var_dump( linkinfo($link_arr[0]) );
|
||||
// check if link is soft link; expected: false as this is a hardlink
|
||||
var_dump( is_link($link_arr[0]) );
|
||||
// delete the links created
|
||||
unlink($link_arr[0]);
|
||||
// clear the cache
|
||||
clearstatcache();
|
||||
|
||||
/* Variation 2 : Create hard link to non-existent file */
|
||||
// non-existing filename
|
||||
$non_existent_file = "$file_path/non_existent_file.tmp";
|
||||
// non-existing linkname
|
||||
$non_existent_linkname = "$file_path/non_existent_linkname.tmp";
|
||||
|
||||
echo "\n*** Creating a hard link to a non-existent file ***\n";
|
||||
// creating hard link to non_existent file
|
||||
var_dump( link($non_existent_file, $non_existent_linkname) ); // expected false
|
||||
// checking linkinfo() and is_link() on the link; expected: false
|
||||
var_dump( linkinfo($non_existent_linkname) );
|
||||
var_dump( is_link($non_existent_linkname) );
|
||||
|
||||
/* Variation 3 : Create file and a link to the file
|
||||
Access data of the file through the link
|
||||
Update the file through link
|
||||
Check size of file and link
|
||||
*/
|
||||
|
||||
echo "\n*** Accessing and updating data of file through soft link ***\n";
|
||||
// Creating file and inserting data into it
|
||||
$filename = "$file_path/symlink_link_is_link_linkinfo.tmp";
|
||||
|
||||
// create temp file
|
||||
$file = fopen($filename, "w");
|
||||
|
||||
// create soft link to file
|
||||
$linkname = "$file_path/symlink_is_link_linkinfo_link.tmp";
|
||||
var_dump( symlink($filename, $linkname) );
|
||||
// storing size of symlink in a local variable
|
||||
$link_stat = lstat($linkname); // lstat of link
|
||||
$link_size = $link_stat[7]; // size of soft link
|
||||
|
||||
// fill data into file
|
||||
fwrite($file, str_repeat("text", 20) );
|
||||
fclose($file);
|
||||
|
||||
echo "\n-- Access data of the file through the soft link --\n";
|
||||
$data_from_link = file_get_contents($linkname); // data read from $filename
|
||||
var_dump( $data_from_link );
|
||||
|
||||
echo "\n-- Check size of soft link and file --\n";
|
||||
var_dump( filesize($filename) );
|
||||
var_dump( filesize($linkname) );
|
||||
|
||||
// taking lstat of symlink
|
||||
$stat = lstat($linkname);
|
||||
// checking that size of symlink remains same
|
||||
if ($link_size == $stat[7])
|
||||
echo "\nSoft link size remains same \n";
|
||||
else
|
||||
echo "\nWarning: Soft link size has changed \n";
|
||||
|
||||
echo "\n-- Updating file with data through soft link --\n";
|
||||
// append link with data
|
||||
$fp = fopen($linkname, "a"); // open in append mode
|
||||
fwrite($fp, "Hello World");
|
||||
fclose($fp);
|
||||
|
||||
// now check temp file for data; it should append "Hello World"
|
||||
$data_from_file = file_get_contents($filename);
|
||||
var_dump( $data_from_file );
|
||||
|
||||
echo "\n-- Check size of soft link and file --\n";
|
||||
var_dump( filesize($filename) );
|
||||
var_dump( filesize($linkname) );
|
||||
|
||||
// taking lstat of symlink
|
||||
$stat = lstat($linkname);
|
||||
// checking that size of symlink remains same
|
||||
if ($link_size == $stat[7])
|
||||
echo "\nSoft link size remains same \n";
|
||||
else
|
||||
echo "\nWarning: Soft link size has changed \n";
|
||||
|
||||
echo "\n-- Updating file with data and check data through soft link --\n";
|
||||
// write to temp file
|
||||
$file = fopen($filename, "w");
|
||||
fwrite($file, "Hello World");
|
||||
fclose($file);
|
||||
|
||||
// now check link for data; it should echo "Hello World"
|
||||
$data_from_link = file_get_contents($linkname);
|
||||
var_dump( $data_from_link );
|
||||
|
||||
echo "\n-- Check size of soft link and file --\n";
|
||||
var_dump( filesize($filename) );
|
||||
var_dump( filesize($linkname) );
|
||||
|
||||
// taking lstat of symlink
|
||||
$stat = lstat($linkname);
|
||||
// checking that size of symlink remains same
|
||||
if ($link_size == $stat[7])
|
||||
echo "\nSoft link size remains same \n";
|
||||
else
|
||||
echo "\nWarning: Soft link size has changed \n";
|
||||
|
||||
// delete the link
|
||||
unlink($linkname);
|
||||
// delete the temporary file
|
||||
unlink($filename);
|
||||
|
||||
echo "\n*** Accessing and updating data of file through hard link ***\n";
|
||||
// Creating file and inserting data into it
|
||||
$filename = "$file_path/symlink_link_is_link_linkinfo.tmp";
|
||||
// create temp file
|
||||
$file = fopen($filename, "w");
|
||||
// fill data into file
|
||||
fwrite($file, str_repeat("text", 20) );
|
||||
fclose($file);
|
||||
|
||||
echo "\n-- Access data of the file through the hard link --\n";
|
||||
// create hard link to file
|
||||
$linkname = "$file_path/symlink_is_link_linkinfo_link.tmp";
|
||||
var_dump( link($filename, $linkname) );
|
||||
$data_from_link = file_get_contents($linkname); // data read from $filename
|
||||
var_dump( $data_from_link );
|
||||
|
||||
echo "\n-- Check size of hard link and file --\n";
|
||||
if( filesize($filename) == filesize($linkname) )
|
||||
echo "\nSize of file and hard link are same\n";
|
||||
else
|
||||
echo "\nWarning: Size of file and hard link differ\n";
|
||||
|
||||
echo "\n-- Updating file with data through hard link --\n";
|
||||
// append link with data
|
||||
$fp = fopen($linkname, "a"); // open in append mode
|
||||
fwrite($fp, "Hello World");
|
||||
fclose($fp);
|
||||
|
||||
// now check temp file for data; it should append "Hello World"
|
||||
$data_from_file = file_get_contents($filename);
|
||||
var_dump( $data_from_file );
|
||||
|
||||
echo "\n-- Check size of hard link and file --\n";
|
||||
if( filesize($filename) == filesize($linkname) )
|
||||
echo "\nSize of file and hard link are same\n";
|
||||
else
|
||||
echo "\nWarning: Size of file and hard link differ\n";
|
||||
|
||||
echo "\n-- Updating file with data and check data through hard link --\n";
|
||||
// write to temp file
|
||||
$file = fopen($filename, "w");
|
||||
fwrite($file, "Hello World");
|
||||
fclose($file);
|
||||
|
||||
// now check link for data; it should echo "Hello World"
|
||||
$data_from_link = file_get_contents($linkname);
|
||||
var_dump( $data_from_link );
|
||||
|
||||
echo "\n-- Check size of hard link and file --\n";
|
||||
var_dump( filesize($filename) );
|
||||
var_dump( filesize($linkname) );
|
||||
if( filesize($filename) == filesize($linkname) )
|
||||
echo "\nSize of file and hard link are same\n";
|
||||
else
|
||||
echo "\nWarning: Size of file and hard link differ\n";
|
||||
|
||||
// delete the link
|
||||
unlink($linkname);
|
||||
// delete the temporary file
|
||||
unlink($filename);
|
||||
|
||||
/* Variation 4 : Creating link, deleting it and checking linkinfo(), is_link() on it */
|
||||
echo "\n*** Testing linkinfo() and is_link() on non-existent link ***\n";
|
||||
// link and file names used here
|
||||
$non_existent_link = "$file_path/non_existent_link.tmp";
|
||||
$filename = "$file_path/symlink_link_linkinfo_is_link/symlink_link_linkinfo_is_link.tmp";
|
||||
var_dump( symlink($filename, $non_existent_link) ); // create link
|
||||
var_dump( unlink($non_existent_link) ); // delete the link
|
||||
// clear the cache
|
||||
clearstatcache();
|
||||
// operating on deleted link; expected: false
|
||||
var_dump( linkinfo($non_existent_link) );
|
||||
var_dump( is_link($non_existent_link) );
|
||||
|
||||
/* Variation 5 : Change permission of directory and try creating links inside that directory */
|
||||
echo "\n*** Creating links in a directory without permission to allow the operation ***\n";
|
||||
// temp file used
|
||||
$filename = "$file_path/symlink_link_linkinfo_is_link/symlink_link_linkinfo_is_link.tmp";
|
||||
// remove all permissions from dir
|
||||
var_dump( chmod($dirname, 0000) );
|
||||
|
||||
echo "\n-- Working with soft links --\n";
|
||||
// expected: false
|
||||
var_dump( symlink($filename, "$dirname/non_existent_link.tmp") );
|
||||
var_dump( linkinfo("$dirname/non_existent_link.tmp") );
|
||||
var_dump( is_link("$dirname/non_existent_link.tmp") );
|
||||
// clear the cache
|
||||
clearstatcache();
|
||||
|
||||
echo "\n-- Working with hard links --\n";
|
||||
// expected: false
|
||||
var_dump( link($filename, "$dirname/non_existent_link.tmp") );
|
||||
var_dump( linkinfo("$dirname/non_existent_link.tmp") );
|
||||
var_dump( is_link("$dirname/non_existent_link.tmp") );
|
||||
// clear the cache
|
||||
clearstatcache();
|
||||
|
||||
chmod($dirname, 0777); // to enable dir deletion
|
||||
|
||||
/* Variation 6 : Create soft/hard link to itself */
|
||||
// temp file used
|
||||
$filename = "$file_path/symlink_link_linkinfo_is_link/symlink_link_linkinfo_is_link.tmp";
|
||||
// link name used
|
||||
$linkname = "$file_path/symlink_link_linkinfo_is_link/symlink_link_linkinfo_is_link_link.tmp";
|
||||
// temp dirname used
|
||||
$dirname = "$file_path/symlink_link_linkinfo_is_link/home/test";
|
||||
|
||||
echo "\n*** Create soft link to file and then to itself ***\n";
|
||||
// create soft link to $filename
|
||||
var_dump( symlink($filename, $linkname) );
|
||||
// create another link to $linkname
|
||||
var_dump( symlink($linkname, $linkname) );
|
||||
// delete link
|
||||
unlink($linkname);
|
||||
|
||||
echo "\n*** Create soft link to directory and then to itself ***\n";
|
||||
// create soft link to $dirname
|
||||
var_dump( symlink($dirname, $linkname) );
|
||||
// create another link to $dirname
|
||||
var_dump( symlink($linkname, $linkname) );
|
||||
// delete link
|
||||
unlink($linkname);
|
||||
|
||||
echo "\n*** Create hard link to file and then to itself ***\n";
|
||||
// create hard link to $filename
|
||||
var_dump( link($filename, $linkname) );
|
||||
// create another link to $linkname
|
||||
var_dump( link($linkname, $linkname) );
|
||||
// delete link
|
||||
unlink($linkname);
|
||||
|
||||
/* Variation 7 : Create soft/hard link to different directory */
|
||||
/* creating link to a file in different dir with the same name as the file */
|
||||
echo "\n*** Create hard link in different directory with same filename ***\n";
|
||||
// temp file used
|
||||
$filename = "$file_path/symlink_link_linkinfo_is_link.tmp";
|
||||
// temp link name used
|
||||
mkdir("$file_path/symlink_link_linkinfo_is_link1");
|
||||
$linkname = "$file_path/symlink_link_linkinfo_is_link1/symlink_link_linkinfo_is_link.tmp";
|
||||
// create temp file
|
||||
$fp = fopen($filename, "w");
|
||||
fclose($fp);
|
||||
|
||||
var_dump( link($filename, "$file_path/symlink_link_linkinfo_is_link1/") ); // this fails indicating file exists
|
||||
// ok, creates "$file_path/symlink_link_linkinfo_is_link1/symlink_link_linkinfo_is_link.tmp" link
|
||||
var_dump( link($filename, $linkname) ); // this works fine
|
||||
// delete link
|
||||
unlink($linkname);
|
||||
// delete temp file
|
||||
unlink($filename);
|
||||
// delete temp dir
|
||||
rmdir("$file_path/symlink_link_linkinfo_is_link1");
|
||||
|
||||
echo "\n*** Create soft link in different directory with same filename ***\n";
|
||||
// temp file used
|
||||
$filename = "$file_path/symlink_link_linkinfo_is_link.tmp";
|
||||
// temp link name used
|
||||
mkdir("$file_path/symlink_link_linkinfo_is_link1");
|
||||
$linkname = "$file_path/symlink_link_linkinfo_is_link1/symlink_link_linkinfo_is_link.tmp";
|
||||
// create temp file
|
||||
$fp = fopen($filename, "w");
|
||||
fclose($fp);
|
||||
|
||||
var_dump( symlink($filename, "$file_path/symlink_link_linkinfo_is_link1/") ); // this fails indicating file exists
|
||||
// ok, creates "$file_path/symlink_link_linkinfo_is_link1/symlink_link_linkinfo_is_link.tmp" link
|
||||
var_dump( symlink($filename, $linkname) ); // this works fine
|
||||
// delete link
|
||||
unlink($linkname);
|
||||
// delete temp file
|
||||
unlink($filename);
|
||||
// delete temp dir
|
||||
rmdir("$file_path/symlink_link_linkinfo_is_link1");
|
||||
|
||||
/* Variation 8 : Check lstat of soft/hard link created
|
||||
Check linkinfo() value with lstat['dev']
|
||||
*/
|
||||
// temp file used
|
||||
$filename = "$file_path/symlink_link_linkinfo_is_link/symlink_link_linkinfo_is_link.tmp";
|
||||
// soft link name used
|
||||
$soft_link = "$file_path/symlink_link_linkinfo_is_link/symlink_link_linkinfo_is_link_softlink.tmp";
|
||||
// hard link name used
|
||||
$hard_link = "$file_path/symlink_link_linkinfo_is_link/symlink_link_linkinfo_is_link_hardlink.tmp";
|
||||
// temp dirname used
|
||||
$dirname = "$file_path/symlink_link_linkinfo_is_link/";
|
||||
|
||||
echo "\n*** Checking lstat() on soft link ***\n";
|
||||
// create soft link
|
||||
var_dump( symlink($filename, $soft_link) );
|
||||
// check lstat of link
|
||||
var_dump( lstat($soft_link) );
|
||||
|
||||
// confirming that linkinfo() = lstat['dev'] , this should always match
|
||||
$linkinfo = linkinfo($soft_link);
|
||||
$s1 = lstat($soft_link);
|
||||
if( $s1[0] == $linkinfo )
|
||||
echo "\nlinkinfo() value matches lstat['dev']\n";
|
||||
else
|
||||
echo "\nWarning: linkinfo() value doesnt match lstat['dev']\n";
|
||||
// delete link
|
||||
unlink($soft_link);
|
||||
|
||||
echo "\n*** Checking lstat() on hard link ***\n";
|
||||
// create hard link
|
||||
var_dump( link($filename, $hard_link) );
|
||||
// check lstat of link
|
||||
var_dump( lstat($hard_link) );
|
||||
|
||||
// confirming that linkinfo() = lstat['dev'] , this should always match
|
||||
$linkinfo = linkinfo($hard_link);
|
||||
$s1 = lstat($hard_link);
|
||||
if( $s1[0] == $linkinfo )
|
||||
echo "\nlinkinfo() value matches lstat['dev']\n";
|
||||
else
|
||||
echo "\nWarning: linkinfo() value doesnt match lstat['dev']\n";
|
||||
|
||||
// delete link
|
||||
unlink($hard_link);
|
||||
|
||||
echo "\n*** Checking lstat() on a soft link to directory ***\n";
|
||||
// create soft link
|
||||
var_dump( symlink($dirname, $soft_link) );
|
||||
// check lstat of link
|
||||
var_dump( lstat($soft_link) );
|
||||
|
||||
// confirming that linkinfo() = lstat['dev'], this should always match
|
||||
$linkinfo = linkinfo($soft_link);
|
||||
$s1 = lstat($soft_link);
|
||||
if( $s1[0] == $linkinfo )
|
||||
echo "\nlinkinfo() value matches lstat['dev']\n";
|
||||
else
|
||||
echo "\nWarning: linkinfo() value doesnt match lstat['dev']\n";
|
||||
|
||||
// delete link
|
||||
unlink($soft_link);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
$file_path = dirname(__FILE__);
|
||||
$dirname = "$file_path/symlink_link_linkinfo_is_link";
|
||||
unlink("$file_path/symlink_link_linkinfo_is_link/symlink_link_linkinfo_is_link.tmp");
|
||||
rmdir("$dirname/test/home");
|
||||
rmdir("$dirname/test");
|
||||
rmdir($dirname);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing symlink(), link(), linkinfo() and is_link() with linknames stored as members in an object ***
|
||||
|
||||
-- Working with soft links --
|
||||
bool(true)
|
||||
int(%i)
|
||||
bool(true)
|
||||
|
||||
-- Working with hard links --
|
||||
bool(true)
|
||||
int(%i)
|
||||
bool(false)
|
||||
|
||||
*** Testing symlink(), link(), linkinfo() and is_link() with linknames stored as members of an array ***
|
||||
|
||||
-- Working with soft links --
|
||||
bool(true)
|
||||
int(%i)
|
||||
bool(true)
|
||||
|
||||
-- Working with hard links --
|
||||
bool(true)
|
||||
int(%i)
|
||||
bool(false)
|
||||
|
||||
*** Creating a hard link to a non-existent file ***
|
||||
|
||||
Warning: link(): No such file or directory in %s on line %i
|
||||
bool(false)
|
||||
|
||||
Warning: linkinfo(): No such file or directory in %s on line %i
|
||||
int(-1)
|
||||
bool(false)
|
||||
|
||||
*** Accessing and updating data of file through soft link ***
|
||||
bool(true)
|
||||
|
||||
-- Access data of the file through the soft link --
|
||||
string(80) "texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext"
|
||||
|
||||
-- Check size of soft link and file --
|
||||
int(80)
|
||||
int(80)
|
||||
|
||||
Soft link size remains same
|
||||
|
||||
-- Updating file with data through soft link --
|
||||
string(91) "texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttextHello World"
|
||||
|
||||
-- Check size of soft link and file --
|
||||
int(91)
|
||||
int(91)
|
||||
|
||||
Soft link size remains same
|
||||
|
||||
-- Updating file with data and check data through soft link --
|
||||
string(11) "Hello World"
|
||||
|
||||
-- Check size of soft link and file --
|
||||
int(11)
|
||||
int(11)
|
||||
|
||||
Soft link size remains same
|
||||
|
||||
*** Accessing and updating data of file through hard link ***
|
||||
|
||||
-- Access data of the file through the hard link --
|
||||
bool(true)
|
||||
string(80) "texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext"
|
||||
|
||||
-- Check size of hard link and file --
|
||||
|
||||
Size of file and hard link are same
|
||||
|
||||
-- Updating file with data through hard link --
|
||||
string(91) "texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttextHello World"
|
||||
|
||||
-- Check size of hard link and file --
|
||||
|
||||
Size of file and hard link are same
|
||||
|
||||
-- Updating file with data and check data through hard link --
|
||||
string(11) "Hello World"
|
||||
|
||||
-- Check size of hard link and file --
|
||||
int(11)
|
||||
int(11)
|
||||
|
||||
Size of file and hard link are same
|
||||
|
||||
*** Testing linkinfo() and is_link() on non-existent link ***
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
Warning: linkinfo(): No such file or directory in %s on line %i
|
||||
int(-1)
|
||||
bool(false)
|
||||
|
||||
*** Creating links in a directory without permission to allow the operation ***
|
||||
bool(true)
|
||||
|
||||
-- Working with soft links --
|
||||
|
||||
Warning: symlink(): Permission denied in %s on line %i
|
||||
bool(false)
|
||||
|
||||
Warning: linkinfo(): Permission denied in %s on line %i
|
||||
int(-1)
|
||||
bool(false)
|
||||
|
||||
-- Working with hard links --
|
||||
|
||||
Warning: link(): Permission denied in %s on line %i
|
||||
bool(false)
|
||||
|
||||
Warning: linkinfo(): Permission denied in %s on line %i
|
||||
int(-1)
|
||||
bool(false)
|
||||
|
||||
*** Create soft link to file and then to itself ***
|
||||
bool(true)
|
||||
|
||||
Warning: symlink(): File exists in %s on line %i
|
||||
bool(false)
|
||||
|
||||
*** Create soft link to directory and then to itself ***
|
||||
bool(true)
|
||||
|
||||
Warning: symlink(): File exists in %s on line %i
|
||||
bool(false)
|
||||
|
||||
*** Create hard link to file and then to itself ***
|
||||
bool(true)
|
||||
|
||||
Warning: link(): File exists in %s on line %i
|
||||
bool(false)
|
||||
|
||||
*** Create hard link in different directory with same filename ***
|
||||
|
||||
Warning: link(): File exists in %s on line %i
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
*** Create soft link in different directory with same filename ***
|
||||
|
||||
Warning: symlink(): File exists in %s on line %i
|
||||
bool(false)
|
||||
bool(true)
|
||||
|
||||
*** Checking lstat() on soft link ***
|
||||
bool(true)
|
||||
array(26) {
|
||||
[0]=>
|
||||
int(%i)
|
||||
[1]=>
|
||||
int(%i)
|
||||
[2]=>
|
||||
int(%i)
|
||||
[3]=>
|
||||
int(1)
|
||||
[4]=>
|
||||
int(%i)
|
||||
[5]=>
|
||||
int(%i)
|
||||
[6]=>
|
||||
int(%i)
|
||||
[7]=>
|
||||
int(%i)
|
||||
[8]=>
|
||||
int(%i)
|
||||
[9]=>
|
||||
int(%i)
|
||||
[10]=>
|
||||
int(%i)
|
||||
[11]=>
|
||||
int(%i)
|
||||
[12]=>
|
||||
int(%i)
|
||||
["dev"]=>
|
||||
int(%i)
|
||||
["ino"]=>
|
||||
int(%i)
|
||||
["mode"]=>
|
||||
int(%i)
|
||||
["nlink"]=>
|
||||
int(1)
|
||||
["uid"]=>
|
||||
int(%i)
|
||||
["gid"]=>
|
||||
int(%i)
|
||||
["rdev"]=>
|
||||
int(%i)
|
||||
["size"]=>
|
||||
int(%i)
|
||||
["atime"]=>
|
||||
int(%i)
|
||||
["mtime"]=>
|
||||
int(%i)
|
||||
["ctime"]=>
|
||||
int(%i)
|
||||
["blksize"]=>
|
||||
int(%i)
|
||||
["blocks"]=>
|
||||
int(%i)
|
||||
}
|
||||
|
||||
linkinfo() value matches lstat['dev']
|
||||
|
||||
*** Checking lstat() on hard link ***
|
||||
bool(true)
|
||||
array(26) {
|
||||
[0]=>
|
||||
int(%i)
|
||||
[1]=>
|
||||
int(%i)
|
||||
[2]=>
|
||||
int(%i)
|
||||
[3]=>
|
||||
int(2)
|
||||
[4]=>
|
||||
int(%i)
|
||||
[5]=>
|
||||
int(%i)
|
||||
[6]=>
|
||||
int(%i)
|
||||
[7]=>
|
||||
int(%i)
|
||||
[8]=>
|
||||
int(%i)
|
||||
[9]=>
|
||||
int(%i)
|
||||
[10]=>
|
||||
int(%i)
|
||||
[11]=>
|
||||
int(%i)
|
||||
[12]=>
|
||||
int(%i)
|
||||
["dev"]=>
|
||||
int(%i)
|
||||
["ino"]=>
|
||||
int(%i)
|
||||
["mode"]=>
|
||||
int(%i)
|
||||
["nlink"]=>
|
||||
int(2)
|
||||
["uid"]=>
|
||||
int(%i)
|
||||
["gid"]=>
|
||||
int(%i)
|
||||
["rdev"]=>
|
||||
int(%i)
|
||||
["size"]=>
|
||||
int(%i)
|
||||
["atime"]=>
|
||||
int(%i)
|
||||
["mtime"]=>
|
||||
int(%i)
|
||||
["ctime"]=>
|
||||
int(%i)
|
||||
["blksize"]=>
|
||||
int(%i)
|
||||
["blocks"]=>
|
||||
int(%i)
|
||||
}
|
||||
|
||||
linkinfo() value matches lstat['dev']
|
||||
|
||||
*** Checking lstat() on a soft link to directory ***
|
||||
bool(true)
|
||||
array(26) {
|
||||
[0]=>
|
||||
int(%i)
|
||||
[1]=>
|
||||
int(%i)
|
||||
[2]=>
|
||||
int(%i)
|
||||
[3]=>
|
||||
int(1)
|
||||
[4]=>
|
||||
int(%i)
|
||||
[5]=>
|
||||
int(%i)
|
||||
[6]=>
|
||||
int(%i)
|
||||
[7]=>
|
||||
int(%i)
|
||||
[8]=>
|
||||
int(%i)
|
||||
[9]=>
|
||||
int(%i)
|
||||
[10]=>
|
||||
int(%i)
|
||||
[11]=>
|
||||
int(%i)
|
||||
[12]=>
|
||||
int(%i)
|
||||
["dev"]=>
|
||||
int(%i)
|
||||
["ino"]=>
|
||||
int(%i)
|
||||
["mode"]=>
|
||||
int(%i)
|
||||
["nlink"]=>
|
||||
int(1)
|
||||
["uid"]=>
|
||||
int(%i)
|
||||
["gid"]=>
|
||||
int(%i)
|
||||
["rdev"]=>
|
||||
int(%i)
|
||||
["size"]=>
|
||||
int(%i)
|
||||
["atime"]=>
|
||||
int(%i)
|
||||
["mtime"]=>
|
||||
int(%i)
|
||||
["ctime"]=>
|
||||
int(%i)
|
||||
["blksize"]=>
|
||||
int(%i)
|
||||
["blocks"]=>
|
||||
int(%i)
|
||||
}
|
||||
|
||||
linkinfo() value matches lstat['dev']
|
||||
Done
|
||||
Reference in New Issue
Block a user