cvs: php-src /ext/standard/tests/file file.inc lstat_stat_variation1.phpt lstat_stat_variation10.phpt lstat_stat_variation11.phpt
lstat_stat_variation12.phpt lstat_stat_variation13.phpt lstat_stat_variation14.phpt lstat_stat_variation15.phpt lstat_stat_variation16.phpt
lstat_stat_variation17.phpt lstat_stat_variation18.phpt lstat_stat_variation19.phpt lstat_stat_variation2.phpt lstat_stat_variation20.phpt
lstat_stat_variation21.phpt lstat_stat_variation3.phpt lstat_stat_variation4.phpt lstat_stat_variation5.phpt lstat_stat_variation6.phpt
lstat_stat_variation7.phpt lstat_stat_variation8.phpt lstat_stat_variation9.phpt
| From: | Raghubansh Kumar | Date: | Thu, 26 Jul 2007 13:55:42 +0000 |
| Subject: | cvs: php-src /ext/standard/tests/file file.inc lstat_stat_variation1.phpt lstat_stat_variation10.phpt lstat_stat_variation11.phpt lstat_stat_variation12.phpt lstat_stat_variation13.phpt lstat_stat_variation14.phpt lstat_stat_variation15.phpt lstat_stat_variation16.phpt lstat_stat_variation17.phpt lstat_stat_variation18.phpt lstat_stat_variation19.phpt lstat_stat_variation2.phpt lstat_stat_variation20.phpt lstat_stat_variation21.phpt lstat_stat_variation3.phpt lstat_stat_variation4.phpt lstat_stat_variation5.phpt lstat_stat_variation6.phpt lstat_stat_variation7.phpt lstat_stat_variation8.phpt lstat_stat_variation9.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-45612@lists.php.net to get a copy of this message | ||
kraghuba Thu Jul 26 13:55:42 2007 UTC
Modified files:
/php-src/ext/standard/tests/file lstat_stat_variation14.phpt
lstat_stat_variation15.phpt
lstat_stat_variation16.phpt
lstat_stat_variation11.phpt
lstat_stat_variation17.phpt
lstat_stat_variation10.phpt
lstat_stat_variation20.phpt
lstat_stat_variation18.phpt
lstat_stat_variation7.phpt
lstat_stat_variation21.phpt
lstat_stat_variation19.phpt
lstat_stat_variation8.phpt
lstat_stat_variation12.phpt
lstat_stat_variation9.phpt
lstat_stat_variation13.phpt
lstat_stat_variation3.phpt
lstat_stat_variation1.phpt
lstat_stat_variation4.phpt
lstat_stat_variation5.phpt
lstat_stat_variation6.phpt
file.inc
lstat_stat_variation2.phpt
Log:
file.inc : Added dumping of stat array in functions (compare_self_stat() & compare_stats() )
Smaller testcases for lstat_stat_variation[1-7].phpt files
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation14.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation14.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation14.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation14.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,70 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - hardlink +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. lstat() not available on Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects of is_link() on stats of hard link */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +/* create temp file & link */ +$filename = "$file_path/lstat_stat_variation14.tmp"; +$fp = fopen($filename, "w"); // temp file +fclose($fp); + +echo "*** Checking lstat() and stat() on hard link ***\n"; +$linkname = "$file_path/lstat_stat_variation14_hard.tmp"; +//ensure that link doesn't exists +@unlink($linkname); + +// create the link +var_dump( link($filename, $linkname) ); +$file_stat = stat($filename); +$link_stat = lstat($linkname); +// compare self stats +var_dump( compare_self_stat($file_stat) ); +var_dump( compare_self_stat($link_stat) ); +// compare the stat +var_dump( compare_stats($file_stat, $link_stat, $all_stat_keys) ); +// clear the stat +clearstatcache(); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation14_hard.tmp"); +unlink("$file_path/lstat_stat_variation14.tmp"); +?> +--EXPECTF-- +*** Checking lstat() and stat() on hard link *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Checking lstat() and stat() on hard link *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation15.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation15.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation15.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation15.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,71 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effects changing permissions of link +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. lstat() not available on Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects on stats by changing permissions of link */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +$filename = "$file_path/lstat_stat_variation15.tmp"; +$fp = fopen($filename, "w"); // temp file +fclose($fp); + +// temp link +$linkname = "$file_path/lstat_stat_variation15_link.tmp"; +symlink($filename, $linkname); + +// checking lstat() and stat() on links +echo "*** Testing lstat() on a link after changing its access permission ***\n"; +clearstatcache(); +$old_stat = lstat($linkname); +var_dump( chmod($linkname, 0777) ); +// clear the stat +clearstatcache(); +sleep(2); +$new_stat = lstat($linkname); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys, "=") ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation15_link.tmp"); +unlink("$file_path/lstat_stat_variation15.tmp"); +?> +--EXPECTF-- +*** Testing lstat() on a link after changing its access permission *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing lstat() on a link after changing its access permission *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation16.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation16.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation16.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation16.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,65 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effects changing permissions of file +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects on stats with changing permissions of file */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +$filename = "$file_path/lstat_stat_variation16.tmp"; +$fp = fopen($filename, "w"); // temp file +fclose($fp); + +// checking stat() on file after changing its permission +echo "*** Testing lstat() on a file after changing its access permission ***\n"; +$old_stat = stat($filename); +sleep(2); +var_dump( chmod($filename, 0777) ); +// clear the stat +clearstatcache(); +$new_stat = stat($filename); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +$affected_members = array(10, 'ctime'); +var_dump( compare_stats($old_stat, $new_stat, $affected_members, "!=") ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation16.tmp"); +?> +--EXPECTF-- +*** Testing lstat() on a file after changing its access permission *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing lstat() on a file after changing its access permission *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation11.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation11.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation11.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation11.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,67 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effect of is_file() +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +/* test the effects of is_file() on stats of a file */ + +/* create temp file */ +$filename = "$file_path/lstat_stat_variation11.tmp"; +$fp = fopen($filename, "w"); // temp file +fclose($fp); + +// is_file() on a file +echo "*** Testing stat() on a file after using is_file() on it ***\n"; +$old_stat = stat($filename); +// clear the stat +clearstatcache(); +sleep(2); +var_dump( is_file($filename) ); +$new_stat = stat($filename); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); +// clear the stat +clearstatcache(); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation11.tmp"); +?> +--EXPECTF-- +*** Testing stat() on a file after using is_file() on it *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() on a file after using is_file() on it *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation17.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation17.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation17.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation17.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,64 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effects changing permissions of dir +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects on stats by changing permissions of a dir */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +// checking stat() on directory +echo "*** Testing lstat() on a dir after changing its access permission ***\n"; +$dirname = "$file_path/lstat_stat_variation17"; +mkdir($dirname); + +$old_stat = stat($dirname); +sleep(2); +var_dump( chmod($dirname, 0777) ); +// clear the stat +clearstatcache(); +$new_stat = stat($dirname); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +$affected_members = array(2, 10, 'mode', 'ctime'); +var_dump( compare_stats($old_stat, $new_stat, $affected_members, "!=") ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +rmdir("$file_path/lstat_stat_variation17"); +?> +--EXPECTF-- +*** Testing lstat() on a dir after changing its access permission *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing lstat() on a dir after changing its access permission *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation10.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation10.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation10.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation10.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,66 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effects of is_dir() +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects of is_dir() on stats of a dir */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +/* create temp file, link and directory */ +$dirname = "$file_path/lstat_stat_variation10"; +mkdir($dirname); // temp dir + +// is_dir() on a directory +echo "*** Testing stat() on directory after using is_dir() on it ***\n"; +$old_stat = stat($dirname); +// clear the cache +clearstatcache(); +sleep(2); +var_dump( is_dir($dirname) ); +$new_stat = stat($dirname); + +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +rmdir("$file_path/lstat_stat_variation10"); +?> +--EXPECTF-- +*** Testing stat() on directory after using is_dir() on it *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() on directory after using is_dir() on it *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation20.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation20.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation20.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation20.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,511 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - link names stored in array/object +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. lstat() not available on Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test for stats of link when their names are stored in object and array */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +$fp = fopen("$file_path/lstat_stat_variation20.tmp", "w"); // temp file +fclose($fp); + +// temp link +symlink("$file_path/lstat_stat_variation20.tmp", "$file_path/lstat_stat_variation20_link.tmp"); + +echo "*** Testing lstat() with linkname stored inside an object/array ***\n"; +class names { + public $var_name; + public function names($name) { + $this->var_name = $name; + } +} + +// link name stored in an object +$link_object = new names("$file_path/lstat_stat_variation20_link.tmp"); + +// link name stored in side an array +// with default numeric key +$link_array = array("$file_path/lstat_stat_variation20_link.tmp"); + +// with string key index +$link_array_with_key = array("linkname" => "$file_path/lstat_stat_variation20_link.tmp"); + +echo "\n-- Testing lstat() on link name stored inside an object --\n"; +var_dump( lstat($link_object->var_name) ); + +echo "\n-- Testing stat() on link name stored inside an array --\n"; +var_dump( stat($link_array[0]) ); // with default numeric index +var_dump( stat($link_array_with_key["linkname"]) ); // with string key +var_dump( stat($link_array_with_key['linkname']) ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation20_link.tmp"); +unlink("$file_path/lstat_stat_variation20.tmp"); +?> +--EXPECTF-- +*** Testing lstat() with linkname stored inside an object/array *** + +-- Testing lstat() on link name stored inside an object -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} + +-- Testing stat() on link name stored inside an array -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} + +--- Done --- +--UEXPECTF-- +*** Testing lstat() with linkname stored inside an object/array *** + +-- Testing lstat() on link name stored inside an object -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} + +-- Testing stat() on link name stored inside an array -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation18.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation18.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation18.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation18.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,292 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - dir/file name stored in object +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test for stats of dir/file when their names are stored in objects */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +/* create temp file and directory */ +mkdir("$file_path/lstat_stat_variation18/"); // temp dir +$fp = fopen("$file_path/lstat_stat_variation18.tmp", "w"); // temp file +fclose($fp); + +echo "*** Testing stat() with filename & directory name stored inside an object ***\n"; + +class names { + public $var_name; + public function names($name) { + $this->var_name = $name; + } +} + +// directory name stored in an object +$dir_name = new names("$file_path/lstat_stat_variation18"); + +// file name stored in an object +$file_name = new names("$file_path/lstat_stat_variation18.tmp"); + +echo "\n-- Testing stat() on filename stored inside an object --\n"; +// dump the stat returned value +var_dump( stat($file_name->var_name) ); + +echo "\n-- Testing stat() on directory name stored inside an object --\n"; +// dump the stat returned value +var_dump( stat($dir_name->var_name) ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation18.tmp"); +rmdir("$file_path/lstat_stat_variation18"); +?> +--EXPECTF-- +*** Testing stat() with filename & directory name stored inside an object *** + +-- Testing stat() on filename stored inside an object -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} + +-- Testing stat() on directory name stored inside an object -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} + +--- Done --- +--UEXPECTF-- +*** Testing stat() with filename & directory name stored inside an object *** + +-- Testing stat() on filename stored inside an object -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} + +-- Testing stat() on directory name stored inside an object -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation7.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation7.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation7.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation7.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,64 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - writing data into file +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +/* test the effects on stats with writing data into a file */ + +$file_name = "$file_path/lstat_stat_variation7.tmp"; +$fp = fopen($file_name, "w"); // temp file +fclose($fp); + +// writing to an empty file +echo "*** Testing stat() on file after data is written in it ***\n"; +$fh = fopen($file_name,"w"); +$old_stat = stat($file_name); +clearstatcache(); +fwrite($fh, (binary)"Hello World"); +$new_stat = stat($file_name); + +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stats +$comp_arr = array(7, 12, 'size', 'blocks'); +var_dump(compare_stats($old_stat, $new_stat, $comp_arr, "<")); +clearstatcache(); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation7.tmp"); +?> +--EXPECTF-- +*** Testing stat() on file after data is written in it *** +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() on file after data is written in it *** +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation21.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation21.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation21.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation21.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,72 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effects of truncate() +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects of truncate() on stats of a file */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +/* create temp file */ +$filename = "$file_path/lstat_stat_variation21.tmp"; +$fp = fopen($filename, "w"); // temp file +fclose($fp); + +/* ftruncate the current file and check stat() on the file */ + +echo "*** Testing stat() on file by truncating it to given size ***\n"; +$old_stat = stat($filename); +// clear the cache +clearstatcache(); +sleep(2); +// opening file in r/w mode +$file_handle = fopen($filename, "r+"); +var_dump( ftruncate($file_handle, 512) ); // truncate it +fclose($file_handle); + +$new_stat = stat($filename); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +$affected_members = array(7, 9, 10, 'size', 'mtime', 'ctime'); +var_dump( compare_stats($old_stat, $new_stat, $affected_members, '!=') ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation21.tmp"); +?> +--EXPECTF-- +*** Testing stat() on file by truncating it to given size *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() on file by truncating it to given size *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation19.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation19.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation19.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation19.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,509 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - dir/file names in array +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test for stats of dir/file when their names are stored in an array */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +/* create temp file, link and directory */ +@rmdir("$file_path/lstat_stat_variation19"); // ensure that dir doesn't exists +mkdir("$file_path/lstat_stat_variation19"); // temp dir + +$fp = fopen("$file_path/lstat_stat_variation19.tmp", "w"); // temp file +fclose($fp); + +echo "*** Testing stat() with filename & directory name stored inside an array ***\n"; + +// array with default numeric index +$names = array( + "$file_path/lstat_stat_variation19.tmp", + "$file_path/lstat_stat_variation19" +); + +//array with string key index +$names_with_key = array ( + 'file' => "$file_path/lstat_stat_variation19.tmp", + "dir" => "$file_path/lstat_stat_variation19" +); + +echo "\n-- Testing stat() on filename stored inside an array --\n"; +var_dump( stat($names[0]) ); // values stored with numeric index +var_dump( stat($names_with_key['file']) ); // value stored with string key + +echo "\n-- Testing stat() on dir name stored inside an array --\n"; +var_dump( stat($names[1]) ); // values stored with numeric index +var_dump( stat($names_with_key["dir"]) ); // value stored with string key + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation19.tmp"); +rmdir("$file_path/lstat_stat_variation19"); +?> +--EXPECTF-- +*** Testing stat() with filename & directory name stored inside an array *** + +-- Testing stat() on filename stored inside an array -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} + +-- Testing stat() on dir name stored inside an array -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} + +--- Done --- +--UEXPECTF-- +*** Testing stat() with filename & directory name stored inside an array *** + +-- Testing stat() on filename stored inside an array -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} + +-- Testing stat() on dir name stored inside an array -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation8.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation8.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation8.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation8.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,68 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - creating file/subdir +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +/* test the effects on stats with creating file/subdir in a dir +*/ + +/* create temp file */ +mkdir("$file_path/lstat_stat_variation8/"); // temp dir + +// creating and deleting subdir and files in the dir +echo "*** Testing stat() on dir after subdir and file is created in it ***\n"; +$dirname = "$file_path/lstat_stat_variation8"; +$old_stat = stat($dirname); +clearstatcache(); +sleep(2); +mkdir("$dirname/lstat_stat_variation8_subdir"); +$file_handle = fopen("$dirname/lstat_stat_variation8a.tmp", "w"); +fclose($file_handle); +$new_stat = stat($dirname); + +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stats +$affected_members = array(3, 9, 10, 'nlink', 'mtime', 'ctime'); +clearstatcache(); +var_dump(compare_stats($old_stat, $new_stat, $affected_members, "<")); + +echo "\n--- Done ---"; +?> +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation8/lstat_stat_variation8a.tmp"); +rmdir("$file_path/lstat_stat_variation8/lstat_stat_variation8_subdir/"); +rmdir("$file_path/lstat_stat_variation8"); +?> +--EXPECTF-- +*** Testing stat() on dir after subdir and file is created in it *** +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() on dir after subdir and file is created in it *** +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation12.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation12.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation12.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation12.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,73 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effects of is_link() +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. lstat() not available on Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects of is_link() on stats of link */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +/* create temp file, link */ +$filename = "$file_path/lstat_stat_variation12.tmp"; +$fp = fopen($filename, "w"); // temp file +fclose($fp); + +$linkname = "$file_path/lstat_stat_variation12_link.tmp"; +symlink($filename, $linkname); // temp link + +// is_link() on a link +echo "*** Testing stat() on a link after using is_link() on it ***\n"; +$linkname = "$file_path/lstat_stat_variation12_link.tmp"; +$old_stat = lstat($linkname); +// clear the stat +clearstatcache(); +sleep(2); +var_dump( is_link($linkname) ); +$new_stat = lstat($linkname); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); +// clear the stat +clearstatcache(); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation12_link.tmp"); +unlink("$file_path/lstat_stat_variation12.tmp"); +?> +--EXPECTF-- +*** Testing stat() on a link after using is_link() on it *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() on a link after using is_link() on it *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation9.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation9.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation9.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation9.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,75 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - deleting file/subdir +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +/* test the effects on stats by deleting file/subdir from a dir +*/ + +echo "*** Testing stat() for comparing stats after the deletion of subdir and file ***\n"; + +/* first create the dir/subdir and files, record the stat */ +@rmdir("$file_path/lstat_stat_variation9/"); // ensure that dir doesn't exists +mkdir("$file_path/lstat_stat_variation9/"); // temp dir + +// creating and deleting subdir and files in the dir +$dirname = "$file_path/lstat_stat_variation9"; +@rmdir("$dirname/lstat_stat_variation9_subdir"); // ensure that dir doesn't exists +mkdir("$dirname/lstat_stat_variation9_subdir"); +$file_handle = fopen("$dirname/lstat_stat_variation9a.tmp", "w"); +fclose($file_handle); + +$old_stat = stat($dirname); + +/* now delete teh surdir and file and record the stat */ +unlink("$dirname/lstat_stat_variation9a.tmp"); +rmdir("$dirname/lstat_stat_variation9_subdir"); + +// comparing stats after the deletion of subdir and file +$new_stat = stat($dirname); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); + +// compare the stats +$affected_members = array(3, 'nlink'); +var_dump(compare_stats($old_stat, $new_stat, $affected_members, ">")); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +$dirname = "$file_path/lstat_stat_variation9"; +rmdir($dirname); +?> +--EXPECTF-- +*** Testing stat() for comparing stats after the deletion of subdir and file *** +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() for comparing stats after the deletion of subdir and file *** +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation13.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation13.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation13.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation13.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,64 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - file opened using w and r mode +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* use stat on file created using "w" and "r" mode of fopen */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +$filename = "$file_path/lstat_stat_variation13.tmp"; + +echo "*** Checking stat() on a file opened using read/write mode ***\n"; +$file_handle = fopen($filename, "w"); // create file +fclose($file_handle); +$old_stat = stat($filename); +// clear the stat +clearstatcache(); +sleep(2); +// opening file again in read mode +$file_handle = fopen($filename, "r"); // read file +fclose($file_handle); +$new_stat = stat($filename); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation13.tmp"); +?> +--EXPECTF-- +*** Checking stat() on a file opened using read/write mode *** +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Checking stat() on a file opened using read/write mode *** +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation3.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation3.phpt diff -u php-src/ext/standard/tests/file/lstat_stat_variation3.phpt:1.1 php-src/ext/standard/tests/file/lstat_stat_variation3.phpt:1.2 --- php-src/ext/standard/tests/file/lstat_stat_variation3.phpt:1.1 Sat Jul 21 17:27:45 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation3.phpt Thu Jul 26 13:55:42 2007 @@ -1,10 +1,9 @@ --TEST-- -Test lstat() and stat() functions: usage variations - writing data in file & creating/deleting file/subdir - +Test lstat() and stat() functions: usage variations - effects of rename() on link --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. lstat() not available on Windows'); + die('skip.. Not valid for Windows'); } ?> --FILE-- @@ -16,68 +15,33 @@ Description: Gives information about a file */ -/* test the effects on the stats for writing to a file and - creating or deleting file/subdir from a dir -*/ +/* test the effects of rename() on stats of link */ $file_path = dirname(__FILE__); require "$file_path/file.inc"; - -/* create temp file, link and directory */ -mkdir("$file_path/lstat_stat_variation3/"); // temp dir - -$file_name = "$file_path/lstat_stat_variation3.tmp"; -$fp = fopen($file_name, "w"); // temp file +/* create temp file & link */ +$fp = fopen("$file_path/lstat_stat_variation3.tmp", "w"); // temp file fclose($fp); -symlink("$file_path/lstat_stat_variation3.tmp", "$file_path/lstat_stat_variation3_link.tmp"); // temp link +// temp link +symlink("$file_path/lstat_stat_variation3.tmp", "$file_path/lstat_stat_variation_link3.tmp"); -// writing to an empty file -echo "-- Testing stat() on file after data is written in it --\n"; -$fh = fopen($file_name,"w"); -$old_stat = stat($file_name); +// renaming a link +echo "*** Testing lstat() for link after being renamed ***\n"; +$old_linkname = "$file_path/lstat_stat_variation_link3.tmp"; +$new_linkname = "$file_path/lstat_stat_variation_link3a.tmp"; +$old_stat = lstat($old_linkname); clearstatcache(); -fwrite($fh, "Hello World"); -$new_stat = stat($file_name); +var_dump( rename($old_linkname, $new_linkname) ); +$new_stat = lstat($new_linkname); // compare self stats var_dump( compare_self_stat($old_stat) ); var_dump( compare_self_stat($new_stat) ); -// compare the stats -$comp_arr = array(7, 12, 'size', 'blocks'); -var_dump(compare_stats($old_stat, $new_stat, $comp_arr, "<")); -clearstatcache(); - -// creating and deleting subdir and files in the dir -echo "-- Testing stat() on dir after subdir and file is created in it --\n"; -$dirname = "$file_path/lstat_stat_variation3"; -$old_stat = stat($dirname); -clearstatcache(); -sleep(2); -mkdir("$dirname/lstat_stat_variation3_subdir"); -$file_handle = fopen("$dirname/lstat_stat_variation3a.tmp", "w"); -fclose($file_handle); -$new_stat = stat($dirname); -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); -// compare the stats -$affected_members = array(3, 9, 10, 'nlink', 'mtime', 'ctime'); -clearstatcache(); -var_dump(compare_stats($old_stat, $new_stat, $affected_members, "<")); -unlink("$dirname/lstat_stat_variation3a.tmp"); -rmdir("$dirname/lstat_stat_variation3_subdir"); - -// comparing stats after the deletion of subdir and file -echo "-- Testing stat() for comparing stats after the deletion of subdir and file --\n"; -$new_stat1 = stat($dirname); -// compare self stats -var_dump( compare_self_stat($new_stat1) ); -// compare the stats -$affected_members = array(3, 'nlink'); -var_dump(compare_stats($new_stat, $new_stat1, $affected_members, ">")); +// compare the two stats +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); echo "\n--- Done ---"; ?> @@ -86,38 +50,21 @@ <?php $file_path = dirname(__FILE__); unlink("$file_path/lstat_stat_variation3.tmp"); -rmdir("$file_path/lstat_stat_variation3"); -unlink("$file_path/lstat_stat_variation3_link.tmp"); +unlink("$file_path/lstat_stat_variation_link3a.tmp"); ?> --EXPECTF-- --- Testing stat() on file after data is written in it -- +*** Testing lstat() for link after being renamed *** bool(true) bool(true) bool(true) --- Testing stat() on dir after subdir and file is created in it -- -bool(true) -bool(true) -bool(true) --- Testing stat() for comparing stats after the deletion of subdir and file -- -bool(true) bool(true) --- Done --- - --UEXPECTF-- --- Testing stat() on file after data is written in it -- - -Notice: fwrite(): 11 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d +*** Testing lstat() for link after being renamed *** bool(true) bool(true) bool(true) --- Testing stat() on dir after subdir and file is created in it -- -bool(true) -bool(true) -bool(true) --- Testing stat() for comparing stats after the deletion of subdir and file -- -bool(true) bool(true) --- Done --- - http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation1.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation1.phpt diff -u php-src/ext/standard/tests/file/lstat_stat_variation1.phpt:1.1 php-src/ext/standard/tests/file/lstat_stat_variation1.phpt:1.2 --- php-src/ext/standard/tests/file/lstat_stat_variation1.phpt:1.1 Sat Jul 21 17:27:45 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation1.phpt Thu Jul 26 13:55:42 2007 @@ -1,9 +1,9 @@ --TEST-- -Test lstat() and stat() functions: usage variations - effects of rename() +Test lstat() and stat() functions: usage variations - effects of rename() on file --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. lstat() not available on Windows'); + die('skip.. Not valid for Windows'); } ?> --FILE-- @@ -15,23 +15,17 @@ Description: Gives information about a file */ -/* test the effects of rename() on stats of dir/file/link */ +/* test the effects of rename() on stats of file */ $file_path = dirname(__FILE__); require "$file_path/file.inc"; -/* create temp file, link and directory */ -mkdir("$file_path/lstat_stat_variation1/"); // temp dir +/* create temp file */ $fp = fopen("$file_path/lstat_stat_variation1.tmp", "w"); // temp file fclose($fp); -// temp link -symlink("$file_path/lstat_stat_variation1.tmp", "$file_path/lstat_stat_variation_link1.tmp"); - -echo "*** Checking lstat() and stat() on file, link and directory ater renaming them ***\n"; - -// renaming a file -echo "-- Testing stat() for files after being renamed --\n"; +// renaming a file and check stat +echo "*** Testing stat() for files after being renamed ***\n"; $file_path = dirname(__FILE__); $old_filename = "$file_path/lstat_stat_variation1.tmp"; $new_filename = "$file_path/lstat_stat_variation1a.tmp"; @@ -49,40 +43,6 @@ // clear the cache clearstatcache(); -// renaming a directory -echo "-- Testing stat() for directory after being renamed --\n"; -$old_dirname = "$file_path/lstat_stat_variation1"; -$new_dirname = "$file_path/lstat_stat_variation1a"; -$old_stat = stat($old_dirname); -clearstatcache(); -var_dump( rename($old_dirname, $new_dirname) ); -$new_stat = stat($new_dirname); - -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); - -// compare the two stats -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); -// clear the cache -clearstatcache(); - -// renaming a link -echo "-- Testing lstat() for link after being renamed --\n"; -$old_linkname = "$file_path/lstat_stat_variation_link1.tmp"; -$new_linkname = "$file_path/lstat_stat_variation_link1a.tmp"; -$old_stat = lstat($old_linkname); -clearstatcache(); -var_dump( rename($old_linkname, $new_linkname) ); -$new_stat = lstat($new_linkname); - -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); - -// compare the two stats -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); - echo "\n--- Done ---"; ?> @@ -90,22 +50,9 @@ <?php $file_path = dirname(__FILE__); unlink("$file_path/lstat_stat_variation1a.tmp"); -rmdir("$file_path/lstat_stat_variation1a"); -unlink("$file_path/lstat_stat_variation_link1a.tmp"); ?> --EXPECTF-- -*** Checking lstat() and stat() on file, link and directory ater renaming them *** --- Testing stat() for files after being renamed -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing stat() for directory after being renamed -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing lstat() for link after being renamed -- +*** Testing stat() for files after being renamed *** bool(true) bool(true) bool(true) @@ -113,18 +60,7 @@ --- Done --- --UEXPECTF-- -*** Checking lstat() and stat() on file, link and directory ater renaming them *** --- Testing stat() for files after being renamed -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing stat() for directory after being renamed -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing lstat() for link after being renamed -- +*** Testing stat() for files after being renamed *** bool(true) bool(true) bool(true) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation4.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation4.phpt diff -u php-src/ext/standard/tests/file/lstat_stat_variation4.phpt:1.1 php-src/ext/standard/tests/file/lstat_stat_variation4.phpt:1.2 --- php-src/ext/standard/tests/file/lstat_stat_variation4.phpt:1.1 Sat Jul 21 17:27:45 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation4.phpt Thu Jul 26 13:55:42 2007 @@ -1,10 +1,9 @@ --TEST-- -Test lstat() and stat() functions: usage variations - effects of is_dir(), is_file() and is_link() - +Test lstat() and stat() functions: usage variations - effects of touch() on file --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. lstat() not available on Windows'); + die('skip.. Not valid for Windows'); } ?> --FILE-- @@ -16,107 +15,35 @@ Description: Gives information about a file */ -/* test the effects of is_dir(), is_file() & is_link() on the stats of dir/file/link */ +/* test the effects of touch() on stats of file */ $file_path = dirname(__FILE__); require "$file_path/file.inc"; -/* create temp file, link and directory */ -$dirname = "$file_path/lstat_stat_variation4"; -mkdir($dirname); // temp dir +/* create temp file */ -$filename = "$file_path/lstat_stat_variation4.tmp"; -$fp = fopen($filename, "w"); // temp file +$file_name = "$file_path/lstat_stat_variation4.tmp"; +$fp = fopen($file_name, "w"); // temp file fclose($fp); -$linkname = "$file_path/lstat_stat_variation4_link.tmp"; -symlink($filename, $linkname); // temp link - -echo "\n*** Checking lstat() and stat() on file, link and directory after accessing it - with is_dir(), is_file() and is_link() functions ***\n"; - -// is_dir() on a directory -echo "-- Testing on Directory --\n"; -$old_stat = stat($dirname); +// touch a file check stat, there should be difference in atime +echo "*** Testing stat() for file after using touch() on the file ***\n"; +$old_stat = stat($file_name); // clear the cache clearstatcache(); sleep(2); -var_dump( is_dir($dirname) ); -$new_stat = stat($dirname); +var_dump( touch($file_name) ); +$new_stat = stat($file_name); // compare self stats var_dump( compare_self_stat($old_stat) ); var_dump( compare_self_stat($new_stat) ); -// compare the stat -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); -// clear the stat -clearstatcache(); - -// is_file() on a file -echo "-- Testing on file --\n"; -$old_stat = stat($filename); -// clear the stat -clearstatcache(); -sleep(2); -var_dump( is_file($filename) ); -$new_stat = stat($filename); -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); // compare the stat -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); -// clear the stat -clearstatcache(); - -// is_link() on a link -echo "-- Testing on link --\n"; -$linkname = "$file_path/lstat_stat_variation4_link.tmp"; -$old_stat = lstat($linkname); -// clear the stat -clearstatcache(); -sleep(2); -var_dump( is_link($linkname) ); -$new_stat = lstat($linkname); -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); -// compare the stat -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); -// clear the stat -clearstatcache(); - -echo "\n*** Checking stat() on a file with read/write permission ***\n"; -$file_handle = fopen($filename, "w"); // create file -fclose($file_handle); -$old_stat = stat($filename); -// clear the stat -clearstatcache(); -sleep(2); -// opening file again in read mode -$file_handle = fopen($filename, "r"); // read file -fclose($file_handle); -$new_stat = stat($filename); -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); -// compare the stat -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); -// clear the stat -clearstatcache(); - -echo "\n*** Checking lstat() and stat() on hard link ***\n"; -$linkname = "$file_path/lstat_stat_variation4_hard.tmp"; -var_dump( link($filename, $linkname) ); -$file_stat = stat($filename); -$link_stat = lstat($linkname); -// compare self stats -var_dump( compare_self_stat($file_stat) ); -var_dump( compare_self_stat($link_stat) ); -// compare the stat -var_dump( compare_stats($file_stat, $link_stat, $all_stat_keys) ); -// clear the stat +$affected_members = array(8, 'atime'); +var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); +// clear the cache clearstatcache(); echo "\n--- Done ---"; @@ -125,36 +52,10 @@ --CLEAN-- <?php $file_path = dirname(__FILE__); -unlink("$file_path/lstat_stat_variation4_hard.tmp"); -unlink("$file_path/lstat_stat_variation4_link.tmp"); unlink("$file_path/lstat_stat_variation4.tmp"); -rmdir("$file_path/lstat_stat_variation4"); ?> --EXPECTF-- -*** Checking lstat() and stat() on file, link and directory after accessing it - with is_dir(), is_file() and is_link() functions *** --- Testing on Directory -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing on file -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing on link -- -bool(true) -bool(true) -bool(true) -bool(true) - -*** Checking stat() on a file with read/write permission *** -bool(true) -bool(true) -bool(true) - -*** Checking lstat() and stat() on hard link *** +*** Testing stat() for file after using touch() on the file *** bool(true) bool(true) bool(true) @@ -162,30 +63,7 @@ --- Done --- --UEXPECTF-- -*** Checking lstat() and stat() on file, link and directory after accessing it - with is_dir(), is_file() and is_link() functions *** --- Testing on Directory -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing on file -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing on link -- -bool(true) -bool(true) -bool(true) -bool(true) - -*** Checking stat() on a file with read/write permission *** -bool(true) -bool(true) -bool(true) - -*** Checking lstat() and stat() on hard link *** +*** Testing stat() for file after using touch() on the file *** bool(true) bool(true) bool(true) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation5.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation5.phpt diff -u php-src/ext/standard/tests/file/lstat_stat_variation5.phpt:1.1 php-src/ext/standard/tests/file/lstat_stat_variation5.phpt:1.2 --- php-src/ext/standard/tests/file/lstat_stat_variation5.phpt:1.1 Sat Jul 21 17:27:45 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation5.phpt Thu Jul 26 13:55:42 2007 @@ -1,11 +1,12 @@ --TEST-- -Test lstat() and stat() functions: usage variations - effects with changing permissions +Test lstat() and stat() functions: usage variations - effects of touch() on dir --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. lstat() not available on Windows'); + die('skip.. Not valid for Windows'); } ?> +?> --FILE-- <?php /* Prototype: array lstat ( string $filename ); @@ -15,73 +16,36 @@ Description: Gives information about a file */ -/* test for effects on stats with changing permissions of dir/file/link */ +/* test the effects of touch() on stats of dir */ $file_path = dirname(__FILE__); require "$file_path/file.inc"; -/* create temp file, link and directory */ -mkdir("$file_path/lstat_stat_variation5/"); // temp dir +/* create temp directory */ -$filename = "$file_path/lstat_stat_variation5.tmp"; -$fp = fopen($filename, "w"); // temp file -fclose($fp); - -// temp link -$linkname = "$file_path/lstat_stat_variation5_link.tmp"; -symlink($filename, $linkname); - -/* Checking lstat() and stat() on file, link and directory after changing permission */ - -// checking lstat() and stat() on links -echo "\n*** Testing lstat() and stat() on links with miscelleneous file permission and content ***\n"; -$old_stat = lstat($linkname); -var_dump( chmod($linkname, 0777) ); -// clear the stat +$dir_name = "$file_path/lstat_stat_variation5"; +@rmdir($dir_name); //ensure that dir doesn't exists +mkdir($dir_name); // temp dir + +// touch a directory and check stat, there should be difference in atime +echo "*** Testing stat() for directory after using touch() on the directory ***\n"; +$old_stat = stat($dir_name); +// clear the cache clearstatcache(); sleep(2); -$new_stat = lstat($linkname); -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); -// compare the stat -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys, "=") ); -// clear the stat -clearstatcache(); +var_dump( touch($dir_name) ); +$new_stat = stat($dir_name); -// checking stat() on file -echo "\n*** Testing lstat() and stat() on file with miscelleneous file permission and content ***\n"; -$old_stat = stat($filename); -var_dump( chmod($filename, 0777) ); -// clear the stat -clearstatcache(); -sleep(2); -$new_stat = stat($filename); // compare self stats var_dump( compare_self_stat($old_stat) ); var_dump( compare_self_stat($new_stat) ); + // compare the stat -$affected_members = array(10, 'ctime'); -var_dump( compare_stats($old_stat, $new_stat, $affected_members, "!=") ); -// clear the stat -clearstatcache(); // clear statement cache - -// checking stat() on directory -echo "\n*** Testing stat() on directory with miscelleneous file permission ***\n"; -$dirname = "$file_path/lstat_stat_variation5"; -$old_stat = stat($dirname); -var_dump( chmod($dirname, 0777) ); -// clear the stat +$affected_members = array(8, 9, 10, 'atime', 'mtime', 'ctime'); +var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); +// clear the cache clearstatcache(); -sleep(2); -$new_stat = stat($dirname); -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); -// compare the stat -$affected_members = array(2, 10, 'mode', 'ctime'); -var_dump( compare_stats($old_stat, $new_stat, $affected_members, "!=") ); echo "\n--- Done ---"; ?> @@ -89,24 +53,10 @@ --CLEAN-- <?php $file_path = dirname(__FILE__); -unlink("$file_path/lstat_stat_variation5_link.tmp"); -unlink("$file_path/lstat_stat_variation5.tmp"); rmdir("$file_path/lstat_stat_variation5"); ?> --EXPECTF-- -*** Testing lstat() and stat() on links with miscelleneous file permission and content *** -bool(true) -bool(true) -bool(true) -bool(true) - -*** Testing lstat() and stat() on file with miscelleneous file permission and content *** -bool(true) -bool(true) -bool(true) -bool(true) - -*** Testing stat() on directory with miscelleneous file permission *** +*** Testing stat() for directory after using touch() on the directory *** bool(true) bool(true) bool(true) @@ -114,19 +64,7 @@ --- Done --- --UEXPECTF-- -*** Testing lstat() and stat() on links with miscelleneous file permission and content *** -bool(true) -bool(true) -bool(true) -bool(true) - -*** Testing lstat() and stat() on file with miscelleneous file permission and content *** -bool(true) -bool(true) -bool(true) -bool(true) - -*** Testing stat() on directory with miscelleneous file permission *** +*** Testing stat() for directory after using touch() on the directory *** bool(true) bool(true) bool(true) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation6.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation6.phpt diff -u php-src/ext/standard/tests/file/lstat_stat_variation6.phpt:1.1 php-src/ext/standard/tests/file/lstat_stat_variation6.phpt:1.2 --- php-src/ext/standard/tests/file/lstat_stat_variation6.phpt:1.1 Sat Jul 21 17:27:45 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation6.phpt Thu Jul 26 13:55:42 2007 @@ -1,5 +1,5 @@ --TEST-- -Test lstat() and stat() functions: usage variations - dir/file/link names stored in objects +Test lstat() and stat() functions: usage variations - effects of touch() on link --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') { @@ -15,65 +15,38 @@ Description: Gives information about a file */ -/* test for stats when names of dir/file/link are stored in objects */ +/* test the effects of touch() on stats of link */ $file_path = dirname(__FILE__); require "$file_path/file.inc"; /* create temp file, link and directory */ -mkdir("$file_path/lstat_stat_variation6/"); // temp dir -$fp = fopen("$file_path/lstat_stat_variation6.tmp", "w"); // temp file +$file_name = "$file_path/lstat_stat_variation6.tmp"; +$fp = fopen($file_name, "w"); // temp file fclose($fp); +$link_name = "$file_path/lstat_stat_variation_link6.tmp"; +symlink($file_name, $link_name); // temp link -// temp link -symlink("$file_path/lstat_stat_variation6.tmp", "$file_path/lstat_stat_variation6_link.tmp"); - -/* Checking lstat() and stat() on file/link/directory where filenames, - linknames and directory names are stored in object and array */ - -echo "\n*** Testing lstat() and stat() with filename, linkname - and directory name stored inside a object ***\n"; - -// creating object with members as numeric and non-numeric filename, linkname and directory name -class object_temp { - public $var_name; - public function object_temp($name) { - $this->var_name = $name; - } -} -// directory as member -$obj1 = new object_temp("$file_path/lstat_stat_variation6/"); -$obj2 = new object_temp("$file_path/lstat_stat_variation6a/"); - -// file as member -$obj3 = new object_temp("$file_path/lstat_stat_variation6.tmp"); -$obj4 = new object_temp("$file_path/lstat_stat_variation6a.tmp"); - -// link as member -$obj5 = new object_temp("$file_path/lstat_stat_variation6_link.tmp"); -$obj6 = new object_temp("$file_path/lstat_stat_variation6a_link.tmp"); - -echo "\n-- Testing lstat() and stat() with softlink, linkname stored inside an object --\n"; - -var_dump( lstat($obj5->var_name) ); - -var_dump( symlink($obj5->var_name, $obj6->var_name) ); -var_dump( lstat($obj6->var_name) ); - -echo "\n-- Testing stat() on filename stored inside an object --\n"; -var_dump( stat($obj3->var_name) ); - -$fp = fopen("$file_path/lstat_stat_variation6a.tmp", "w"); -fclose($fp); -var_dump( stat($obj4->var_name) ); - -echo "\n-- Testing stat() on directory name stored inside an object --\n"; -var_dump( stat($obj1->var_name) ); - -mkdir("$file_path/lstat_stat_variation6a/"); -var_dump( stat($obj2->var_name) ); +// touch a link, check stat, there should be difference in atime +echo "*** Testing lstat() for link after using touch() on the link ***\n"; +$old_stat = lstat($link_name); +// clear the cache +clearstatcache(); +sleep(2); +var_dump( touch($link_name) ); +$new_stat = lstat($link_name); + +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); + +// compare the stat +$affected_members = array(8, 'atime'); +var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); +// clear the stat +clearstatcache(); echo "\n--- Done ---"; ?> @@ -81,683 +54,22 @@ --CLEAN-- <?php $file_path = dirname(__FILE__); -unlink("$file_path/lstat_stat_variation6_link.tmp"); unlink("$file_path/lstat_stat_variation6.tmp"); -rmdir("$file_path/lstat_stat_variation6"); -unlink("$file_path/lstat_stat_variation6a_link.tmp"); -unlink("$file_path/lstat_stat_variation6a.tmp"); -rmdir("$file_path/lstat_stat_variation6a/"); +unlink("$file_path/lstat_stat_variation_link6.tmp"); ?> - --EXPECTF-- -*** Testing lstat() and stat() with filename, linkname - and directory name stored inside a object *** - --- Testing lstat() and stat() with softlink, linkname stored inside an object -- -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - ["dev"]=> - int(%d) - ["ino"]=> - int(%d) - ["mode"]=> - int(%d) - ["nlink"]=> - int(%d) - ["uid"]=> - int(%d) - ["gid"]=> - int(%d) - ["rdev"]=> - int(%d) - ["size"]=> - int(%d) - ["atime"]=> - int(%d) - ["mtime"]=> - int(%d) - ["ctime"]=> - int(%d) - ["blksize"]=> - int(%d) - ["blocks"]=> - int(%d) -} +*** Testing lstat() for link after using touch() on the link *** +bool(true) +bool(true) +bool(true) bool(true) -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - ["dev"]=> - int(%d) - ["ino"]=> - int(%d) - ["mode"]=> - int(%d) - ["nlink"]=> - int(%d) - ["uid"]=> - int(%d) - ["gid"]=> - int(%d) - ["rdev"]=> - int(%d) - ["size"]=> - int(%d) - ["atime"]=> - int(%d) - ["mtime"]=> - int(%d) - ["ctime"]=> - int(%d) - ["blksize"]=> - int(%d) - ["blocks"]=> - int(%d) -} - --- Testing stat() on filename stored inside an object -- -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - ["dev"]=> - int(%d) - ["ino"]=> - int(%d) - ["mode"]=> - int(%d) - ["nlink"]=> - int(%d) - ["uid"]=> - int(%d) - ["gid"]=> - int(%d) - ["rdev"]=> - int(%d) - ["size"]=> - int(%d) - ["atime"]=> - int(%d) - ["mtime"]=> - int(%d) - ["ctime"]=> - int(%d) - ["blksize"]=> - int(%d) - ["blocks"]=> - int(%d) -} -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - ["dev"]=> - int(%d) - ["ino"]=> - int(%d) - ["mode"]=> - int(%d) - ["nlink"]=> - int(%d) - ["uid"]=> - int(%d) - ["gid"]=> - int(%d) - ["rdev"]=> - int(%d) - ["size"]=> - int(%d) - ["atime"]=> - int(%d) - ["mtime"]=> - int(%d) - ["ctime"]=> - int(%d) - ["blksize"]=> - int(%d) - ["blocks"]=> - int(%d) -} - --- Testing stat() on directory name stored inside an object -- -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - ["dev"]=> - int(%d) - ["ino"]=> - int(%d) - ["mode"]=> - int(%d) - ["nlink"]=> - int(%d) - ["uid"]=> - int(%d) - ["gid"]=> - int(%d) - ["rdev"]=> - int(%d) - ["size"]=> - int(%d) - ["atime"]=> - int(%d) - ["mtime"]=> - int(%d) - ["ctime"]=> - int(%d) - ["blksize"]=> - int(%d) - ["blocks"]=> - int(%d) -} -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - ["dev"]=> - int(%d) - ["ino"]=> - int(%d) - ["mode"]=> - int(%d) - ["nlink"]=> - int(%d) - ["uid"]=> - int(%d) - ["gid"]=> - int(%d) - ["rdev"]=> - int(%d) - ["size"]=> - int(%d) - ["atime"]=> - int(%d) - ["mtime"]=> - int(%d) - ["ctime"]=> - int(%d) - ["blksize"]=> - int(%d) - ["blocks"]=> - int(%d) -} --- Done --- --UEXPECTF-- -*** Testing lstat() and stat() with filename, linkname - and directory name stored inside a object *** - --- Testing lstat() and stat() with softlink, linkname stored inside an object -- -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - [u"dev"]=> - int(%d) - [u"ino"]=> - int(%d) - [u"mode"]=> - int(%d) - [u"nlink"]=> - int(%d) - [u"uid"]=> - int(%d) - [u"gid"]=> - int(%d) - [u"rdev"]=> - int(%d) - [u"size"]=> - int(%d) - [u"atime"]=> - int(%d) - [u"mtime"]=> - int(%d) - [u"ctime"]=> - int(%d) - [u"blksize"]=> - int(%d) - [u"blocks"]=> - int(%d) -} +*** Testing lstat() for link after using touch() on the link *** +bool(true) +bool(true) +bool(true) bool(true) -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - [u"dev"]=> - int(%d) - [u"ino"]=> - int(%d) - [u"mode"]=> - int(%d) - [u"nlink"]=> - int(%d) - [u"uid"]=> - int(%d) - [u"gid"]=> - int(%d) - [u"rdev"]=> - int(%d) - [u"size"]=> - int(%d) - [u"atime"]=> - int(%d) - [u"mtime"]=> - int(%d) - [u"ctime"]=> - int(%d) - [u"blksize"]=> - int(%d) - [u"blocks"]=> - int(%d) -} - --- Testing stat() on filename stored inside an object -- -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - [u"dev"]=> - int(%d) - [u"ino"]=> - int(%d) - [u"mode"]=> - int(%d) - [u"nlink"]=> - int(%d) - [u"uid"]=> - int(%d) - [u"gid"]=> - int(%d) - [u"rdev"]=> - int(%d) - [u"size"]=> - int(%d) - [u"atime"]=> - int(%d) - [u"mtime"]=> - int(%d) - [u"ctime"]=> - int(%d) - [u"blksize"]=> - int(%d) - [u"blocks"]=> - int(%d) -} -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - [u"dev"]=> - int(%d) - [u"ino"]=> - int(%d) - [u"mode"]=> - int(%d) - [u"nlink"]=> - int(%d) - [u"uid"]=> - int(%d) - [u"gid"]=> - int(%d) - [u"rdev"]=> - int(%d) - [u"size"]=> - int(%d) - [u"atime"]=> - int(%d) - [u"mtime"]=> - int(%d) - [u"ctime"]=> - int(%d) - [u"blksize"]=> - int(%d) - [u"blocks"]=> - int(%d) -} - --- Testing stat() on directory name stored inside an object -- -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - [u"dev"]=> - int(%d) - [u"ino"]=> - int(%d) - [u"mode"]=> - int(%d) - [u"nlink"]=> - int(%d) - [u"uid"]=> - int(%d) - [u"gid"]=> - int(%d) - [u"rdev"]=> - int(%d) - [u"size"]=> - int(%d) - [u"atime"]=> - int(%d) - [u"mtime"]=> - int(%d) - [u"ctime"]=> - int(%d) - [u"blksize"]=> - int(%d) - [u"blocks"]=> - int(%d) -} -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - [u"dev"]=> - int(%d) - [u"ino"]=> - int(%d) - [u"mode"]=> - int(%d) - [u"nlink"]=> - int(%d) - [u"uid"]=> - int(%d) - [u"gid"]=> - int(%d) - [u"rdev"]=> - int(%d) - [u"size"]=> - int(%d) - [u"atime"]=> - int(%d) - [u"mtime"]=> - int(%d) - [u"ctime"]=> - int(%d) - [u"blksize"]=> - int(%d) - [u"blocks"]=> - int(%d) -} --- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/file.inc?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/standard/tests/file/file.inc diff -u php-src/ext/standard/tests/file/file.inc:1.6 php-src/ext/standard/tests/file/file.inc:1.7 --- php-src/ext/standard/tests/file/file.inc:1.6 Fri Jul 20 18:09:11 2007 +++ php-src/ext/standard/tests/file/file.inc Thu Jul 26 13:55:42 2007 @@ -548,7 +548,7 @@ foreach($string_keys as $str_key) { if($stat[$key] != $stat[$str_key]) { - echo "stat[$key] doesn't match with stat[$str_key]\n"; + echo "Error: stat[$key] doesn't match with stat[$str_key]\n"; $flag = false; $key++; } @@ -557,6 +557,13 @@ } } // end of foreach + // if the $return_value is false, i.e all the element do not match then + // dump the stat array so that its easy to figure out the error + if ($return_value == false ) { + echo "\n Dumping stat array ...\n"; + var_dump($stat); + } + return $return_value; }// end of compare_self_stat @@ -597,7 +604,7 @@ case "==": if ( $stat1[ $fields[$index] ] != $stat2[ $fields[$index] ] ) { $result = false; - echo "stat1 do not match with stat2 at key value: $fields[$index]\n"; + echo "Error: stat1 do not match with stat2 at key value: $fields[$index]\n"; } break; @@ -606,25 +613,34 @@ // do nothing as its not equal, else will take care of if equal } else { $result = false; - echo "stat1 equals stat2 at key value: $fields[$index]\n"; + echo "Error: stat1 equals stat2 at key value: $fields[$index]\n"; } break; case ">": if ( $stat1[ $fields[$index] ] <= $stat2[ $fields[$index] ] ) { $result = false; - echo "stat1 is not greater than stat2 at key value: $fields[$index]\n"; + echo "Error: stat1 is not greater than stat2 at key value: $fields[$index]\n"; } break; case "<": if ( $stat1[ $fields[$index] ] >= $stat2[ $fields[$index] ] ) { $result = false; - echo "stat1 is not lesser than stat2 at key value: $fields[$index]\n"; + echo "Error: stat1 is not lesser than stat2 at key value: $fields[$index]\n"; } break; } } + // if the result is false(i.e values are not as expected), + // dump the stat array so that easy to figure out the error + if ( $result == false ) { + echo "\n Dumping stat array 1...\n"; + var_dump($stat1); + echo "\n Dumping stat array 2...\n"; + var_dump($stat2); + } + return $result; } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation2.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation2.phpt diff -u php-src/ext/standard/tests/file/lstat_stat_variation2.phpt:1.1 php-src/ext/standard/tests/file/lstat_stat_variation2.phpt:1.2 --- php-src/ext/standard/tests/file/lstat_stat_variation2.phpt:1.1 Sat Jul 21 17:27:45 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation2.phpt Thu Jul 26 13:55:42 2007 @@ -1,9 +1,9 @@ --TEST-- -Test lstat() and stat() functions: usage variations - effects of touch() +Test lstat() and stat() functions: usage variations - effects of rename() on dir --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. lstat() not available on Windows'); + die('skip.. Not valid for Windows'); } ?> --FILE-- @@ -15,106 +15,43 @@ Description: Gives information about a file */ -/* test the effects of touch() on the stats of dir/file/link */ +/* test the effects of rename() on stats of dir */ $file_path = dirname(__FILE__); -require "$file_path/file.inc"; +require("file.inc"); - -/* create temp file, link and directory */ - -$dir_name = "$file_path/lstat_stat_variation2/"; -mkdir($dir_name); // temp dir -$file_name = "$file_path/lstat_stat_variation2.tmp"; -$fp = fopen($file_name, "w"); // temp file -fclose($fp); -$link_name = "$file_path/lstat_stat_variation_link2.tmp"; -symlink($file_name, $link_name); // temp link - - -echo "\n*** Checking lstat() and stat() on file, link and directory after touching them ***\n"; - -// touch a file -echo "-- Testing stat() for file after using touch() on the file --\n"; -$old_stat = stat($file_name); -// clear the cache +/* create temp directory */ +@rmdir("$file_path/lstat_stat_variation2/"); //ensure that dir doesn't exists +mkdir("$file_path/lstat_stat_variation2/"); // temp dir + +// renaming a directory and check stat +echo "*** Testing stat() for directory after being renamed ***\n"; +$old_dirname = "$file_path/lstat_stat_variation2"; +$new_dirname = "$file_path/lstat_stat_variation2a"; +$old_stat = stat($old_dirname); clearstatcache(); -sleep(2); -var_dump( touch($file_name) ); -$new_stat = stat($file_name); +var_dump( rename($old_dirname, $new_dirname) ); +$new_stat = stat($new_dirname); // compare self stats var_dump( compare_self_stat($old_stat) ); var_dump( compare_self_stat($new_stat) ); -// compare the stat -$affected_members = array(8, 'atime'); -var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); +// compare the two stats +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); // clear the cache clearstatcache(); - -// touch a directory -echo "-- Testing stat() for directory after using touch() on the directory --\n"; -$old_stat = stat($dir_name); -// clear the cache -clearstatcache(); -sleep(2); -var_dump( touch($dir_name) ); -$new_stat = stat($dir_name); - -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); - -// compare the stat -$affected_members = array(8, 9, 10, 'atime', 'mtime', 'ctime'); -var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); -// clear the cache -clearstatcache(); - -// touch a link -echo "-- Testing lstat() for link after using touch() on the link --\n"; -$old_stat = lstat($link_name); -// clear the cache -clearstatcache(); -sleep(2); -var_dump( touch($link_name) ); -$new_stat = lstat($link_name); - -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); - -// compare the stat -$affected_members = array(8, 'atime'); -var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); -// clear the stat -clearstatcache(); - echo "\n--- Done ---"; ?> --CLEAN-- <?php $file_path = dirname(__FILE__); -unlink("$file_path/lstat_stat_variation2.tmp"); -rmdir("$file_path/lstat_stat_variation2"); -unlink("$file_path/lstat_stat_variation_link2.tmp"); +rmdir("$file_path/lstat_stat_variation2a"); ?> --EXPECTF-- -*** Checking lstat() and stat() on file, link and directory after touching them *** --- Testing stat() for file after using touch() on the file -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing stat() for directory after using touch() on the directory -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing lstat() for link after using touch() on the link -- +*** Testing stat() for directory after being renamed *** bool(true) bool(true) bool(true) @@ -122,18 +59,7 @@ --- Done --- --UEXPECTF-- -*** Checking lstat() and stat() on file, link and directory after touching them *** --- Testing stat() for file after using touch() on the file -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing stat() for directory after using touch() on the directory -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing lstat() for link after using touch() on the link -- +*** Testing stat() for directory after being renamed *** bool(true) bool(true) bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation14.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation14.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation14.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation14.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,70 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - hardlink +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. lstat() not available on Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects of is_link() on stats of hard link */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +/* create temp file & link */ +$filename = "$file_path/lstat_stat_variation14.tmp"; +$fp = fopen($filename, "w"); // temp file +fclose($fp); + +echo "*** Checking lstat() and stat() on hard link ***\n"; +$linkname = "$file_path/lstat_stat_variation14_hard.tmp"; +//ensure that link doesn't exists +@unlink($linkname); + +// create the link +var_dump( link($filename, $linkname) ); +$file_stat = stat($filename); +$link_stat = lstat($linkname); +// compare self stats +var_dump( compare_self_stat($file_stat) ); +var_dump( compare_self_stat($link_stat) ); +// compare the stat +var_dump( compare_stats($file_stat, $link_stat, $all_stat_keys) ); +// clear the stat +clearstatcache(); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation14_hard.tmp"); +unlink("$file_path/lstat_stat_variation14.tmp"); +?> +--EXPECTF-- +*** Checking lstat() and stat() on hard link *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Checking lstat() and stat() on hard link *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation15.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation15.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation15.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation15.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,71 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effects changing permissions of link +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. lstat() not available on Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects on stats by changing permissions of link */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +$filename = "$file_path/lstat_stat_variation15.tmp"; +$fp = fopen($filename, "w"); // temp file +fclose($fp); + +// temp link +$linkname = "$file_path/lstat_stat_variation15_link.tmp"; +symlink($filename, $linkname); + +// checking lstat() and stat() on links +echo "*** Testing lstat() on a link after changing its access permission ***\n"; +clearstatcache(); +$old_stat = lstat($linkname); +var_dump( chmod($linkname, 0777) ); +// clear the stat +clearstatcache(); +sleep(2); +$new_stat = lstat($linkname); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys, "=") ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation15_link.tmp"); +unlink("$file_path/lstat_stat_variation15.tmp"); +?> +--EXPECTF-- +*** Testing lstat() on a link after changing its access permission *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing lstat() on a link after changing its access permission *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation16.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation16.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation16.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation16.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,65 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effects changing permissions of file +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects on stats with changing permissions of file */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +$filename = "$file_path/lstat_stat_variation16.tmp"; +$fp = fopen($filename, "w"); // temp file +fclose($fp); + +// checking stat() on file after changing its permission +echo "*** Testing lstat() on a file after changing its access permission ***\n"; +$old_stat = stat($filename); +sleep(2); +var_dump( chmod($filename, 0777) ); +// clear the stat +clearstatcache(); +$new_stat = stat($filename); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +$affected_members = array(10, 'ctime'); +var_dump( compare_stats($old_stat, $new_stat, $affected_members, "!=") ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation16.tmp"); +?> +--EXPECTF-- +*** Testing lstat() on a file after changing its access permission *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing lstat() on a file after changing its access permission *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation11.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation11.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation11.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation11.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,67 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effect of is_file() +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +/* test the effects of is_file() on stats of a file */ + +/* create temp file */ +$filename = "$file_path/lstat_stat_variation11.tmp"; +$fp = fopen($filename, "w"); // temp file +fclose($fp); + +// is_file() on a file +echo "*** Testing stat() on a file after using is_file() on it ***\n"; +$old_stat = stat($filename); +// clear the stat +clearstatcache(); +sleep(2); +var_dump( is_file($filename) ); +$new_stat = stat($filename); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); +// clear the stat +clearstatcache(); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation11.tmp"); +?> +--EXPECTF-- +*** Testing stat() on a file after using is_file() on it *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() on a file after using is_file() on it *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation17.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation17.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation17.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation17.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,64 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effects changing permissions of dir +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects on stats by changing permissions of a dir */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +// checking stat() on directory +echo "*** Testing lstat() on a dir after changing its access permission ***\n"; +$dirname = "$file_path/lstat_stat_variation17"; +mkdir($dirname); + +$old_stat = stat($dirname); +sleep(2); +var_dump( chmod($dirname, 0777) ); +// clear the stat +clearstatcache(); +$new_stat = stat($dirname); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +$affected_members = array(2, 10, 'mode', 'ctime'); +var_dump( compare_stats($old_stat, $new_stat, $affected_members, "!=") ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +rmdir("$file_path/lstat_stat_variation17"); +?> +--EXPECTF-- +*** Testing lstat() on a dir after changing its access permission *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing lstat() on a dir after changing its access permission *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation10.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation10.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation10.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation10.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,66 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effects of is_dir() +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects of is_dir() on stats of a dir */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +/* create temp file, link and directory */ +$dirname = "$file_path/lstat_stat_variation10"; +mkdir($dirname); // temp dir + +// is_dir() on a directory +echo "*** Testing stat() on directory after using is_dir() on it ***\n"; +$old_stat = stat($dirname); +// clear the cache +clearstatcache(); +sleep(2); +var_dump( is_dir($dirname) ); +$new_stat = stat($dirname); + +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +rmdir("$file_path/lstat_stat_variation10"); +?> +--EXPECTF-- +*** Testing stat() on directory after using is_dir() on it *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() on directory after using is_dir() on it *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation20.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation20.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation20.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation20.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,511 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - link names stored in array/object +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. lstat() not available on Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test for stats of link when their names are stored in object and array */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +$fp = fopen("$file_path/lstat_stat_variation20.tmp", "w"); // temp file +fclose($fp); + +// temp link +symlink("$file_path/lstat_stat_variation20.tmp", "$file_path/lstat_stat_variation20_link.tmp"); + +echo "*** Testing lstat() with linkname stored inside an object/array ***\n"; +class names { + public $var_name; + public function names($name) { + $this->var_name = $name; + } +} + +// link name stored in an object +$link_object = new names("$file_path/lstat_stat_variation20_link.tmp"); + +// link name stored in side an array +// with default numeric key +$link_array = array("$file_path/lstat_stat_variation20_link.tmp"); + +// with string key index +$link_array_with_key = array("linkname" => "$file_path/lstat_stat_variation20_link.tmp"); + +echo "\n-- Testing lstat() on link name stored inside an object --\n"; +var_dump( lstat($link_object->var_name) ); + +echo "\n-- Testing stat() on link name stored inside an array --\n"; +var_dump( stat($link_array[0]) ); // with default numeric index +var_dump( stat($link_array_with_key["linkname"]) ); // with string key +var_dump( stat($link_array_with_key['linkname']) ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation20_link.tmp"); +unlink("$file_path/lstat_stat_variation20.tmp"); +?> +--EXPECTF-- +*** Testing lstat() with linkname stored inside an object/array *** + +-- Testing lstat() on link name stored inside an object -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} + +-- Testing stat() on link name stored inside an array -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} + +--- Done --- +--UEXPECTF-- +*** Testing lstat() with linkname stored inside an object/array *** + +-- Testing lstat() on link name stored inside an object -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} + +-- Testing stat() on link name stored inside an array -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation18.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation18.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation18.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation18.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,292 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - dir/file name stored in object +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test for stats of dir/file when their names are stored in objects */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +/* create temp file and directory */ +mkdir("$file_path/lstat_stat_variation18/"); // temp dir +$fp = fopen("$file_path/lstat_stat_variation18.tmp", "w"); // temp file +fclose($fp); + +echo "*** Testing stat() with filename & directory name stored inside an object ***\n"; + +class names { + public $var_name; + public function names($name) { + $this->var_name = $name; + } +} + +// directory name stored in an object +$dir_name = new names("$file_path/lstat_stat_variation18"); + +// file name stored in an object +$file_name = new names("$file_path/lstat_stat_variation18.tmp"); + +echo "\n-- Testing stat() on filename stored inside an object --\n"; +// dump the stat returned value +var_dump( stat($file_name->var_name) ); + +echo "\n-- Testing stat() on directory name stored inside an object --\n"; +// dump the stat returned value +var_dump( stat($dir_name->var_name) ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation18.tmp"); +rmdir("$file_path/lstat_stat_variation18"); +?> +--EXPECTF-- +*** Testing stat() with filename & directory name stored inside an object *** + +-- Testing stat() on filename stored inside an object -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} + +-- Testing stat() on directory name stored inside an object -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} + +--- Done --- +--UEXPECTF-- +*** Testing stat() with filename & directory name stored inside an object *** + +-- Testing stat() on filename stored inside an object -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} + +-- Testing stat() on directory name stored inside an object -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation7.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation7.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation7.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation7.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,64 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - writing data into file +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +/* test the effects on stats with writing data into a file */ + +$file_name = "$file_path/lstat_stat_variation7.tmp"; +$fp = fopen($file_name, "w"); // temp file +fclose($fp); + +// writing to an empty file +echo "*** Testing stat() on file after data is written in it ***\n"; +$fh = fopen($file_name,"w"); +$old_stat = stat($file_name); +clearstatcache(); +fwrite($fh, (binary)"Hello World"); +$new_stat = stat($file_name); + +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stats +$comp_arr = array(7, 12, 'size', 'blocks'); +var_dump(compare_stats($old_stat, $new_stat, $comp_arr, "<")); +clearstatcache(); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation7.tmp"); +?> +--EXPECTF-- +*** Testing stat() on file after data is written in it *** +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() on file after data is written in it *** +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation21.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation21.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation21.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation21.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,72 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effects of truncate() +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects of truncate() on stats of a file */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +/* create temp file */ +$filename = "$file_path/lstat_stat_variation21.tmp"; +$fp = fopen($filename, "w"); // temp file +fclose($fp); + +/* ftruncate the current file and check stat() on the file */ + +echo "*** Testing stat() on file by truncating it to given size ***\n"; +$old_stat = stat($filename); +// clear the cache +clearstatcache(); +sleep(2); +// opening file in r/w mode +$file_handle = fopen($filename, "r+"); +var_dump( ftruncate($file_handle, 512) ); // truncate it +fclose($file_handle); + +$new_stat = stat($filename); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +$affected_members = array(7, 9, 10, 'size', 'mtime', 'ctime'); +var_dump( compare_stats($old_stat, $new_stat, $affected_members, '!=') ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation21.tmp"); +?> +--EXPECTF-- +*** Testing stat() on file by truncating it to given size *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() on file by truncating it to given size *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation19.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation19.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation19.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation19.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,509 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - dir/file names in array +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test for stats of dir/file when their names are stored in an array */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +/* create temp file, link and directory */ +@rmdir("$file_path/lstat_stat_variation19"); // ensure that dir doesn't exists +mkdir("$file_path/lstat_stat_variation19"); // temp dir + +$fp = fopen("$file_path/lstat_stat_variation19.tmp", "w"); // temp file +fclose($fp); + +echo "*** Testing stat() with filename & directory name stored inside an array ***\n"; + +// array with default numeric index +$names = array( + "$file_path/lstat_stat_variation19.tmp", + "$file_path/lstat_stat_variation19" +); + +//array with string key index +$names_with_key = array ( + 'file' => "$file_path/lstat_stat_variation19.tmp", + "dir" => "$file_path/lstat_stat_variation19" +); + +echo "\n-- Testing stat() on filename stored inside an array --\n"; +var_dump( stat($names[0]) ); // values stored with numeric index +var_dump( stat($names_with_key['file']) ); // value stored with string key + +echo "\n-- Testing stat() on dir name stored inside an array --\n"; +var_dump( stat($names[1]) ); // values stored with numeric index +var_dump( stat($names_with_key["dir"]) ); // value stored with string key + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation19.tmp"); +rmdir("$file_path/lstat_stat_variation19"); +?> +--EXPECTF-- +*** Testing stat() with filename & directory name stored inside an array *** + +-- Testing stat() on filename stored inside an array -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} + +-- Testing stat() on dir name stored inside an array -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + ["dev"]=> + int(%d) + ["ino"]=> + int(%d) + ["mode"]=> + int(%d) + ["nlink"]=> + int(%d) + ["uid"]=> + int(%d) + ["gid"]=> + int(%d) + ["rdev"]=> + int(%d) + ["size"]=> + int(%d) + ["atime"]=> + int(%d) + ["mtime"]=> + int(%d) + ["ctime"]=> + int(%d) + ["blksize"]=> + int(%d) + ["blocks"]=> + int(%d) +} + +--- Done --- +--UEXPECTF-- +*** Testing stat() with filename & directory name stored inside an array *** + +-- Testing stat() on filename stored inside an array -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} + +-- Testing stat() on dir name stored inside an array -- +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} +array(26) { + [0]=> + int(%d) + [1]=> + int(%d) + [2]=> + int(%d) + [3]=> + int(%d) + [4]=> + int(%d) + [5]=> + int(%d) + [6]=> + int(%d) + [7]=> + int(%d) + [8]=> + int(%d) + [9]=> + int(%d) + [10]=> + int(%d) + [11]=> + int(%d) + [12]=> + int(%d) + [u"dev"]=> + int(%d) + [u"ino"]=> + int(%d) + [u"mode"]=> + int(%d) + [u"nlink"]=> + int(%d) + [u"uid"]=> + int(%d) + [u"gid"]=> + int(%d) + [u"rdev"]=> + int(%d) + [u"size"]=> + int(%d) + [u"atime"]=> + int(%d) + [u"mtime"]=> + int(%d) + [u"ctime"]=> + int(%d) + [u"blksize"]=> + int(%d) + [u"blocks"]=> + int(%d) +} + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation8.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation8.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation8.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation8.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,68 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - creating file/subdir +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +/* test the effects on stats with creating file/subdir in a dir +*/ + +/* create temp file */ +mkdir("$file_path/lstat_stat_variation8/"); // temp dir + +// creating and deleting subdir and files in the dir +echo "*** Testing stat() on dir after subdir and file is created in it ***\n"; +$dirname = "$file_path/lstat_stat_variation8"; +$old_stat = stat($dirname); +clearstatcache(); +sleep(2); +mkdir("$dirname/lstat_stat_variation8_subdir"); +$file_handle = fopen("$dirname/lstat_stat_variation8a.tmp", "w"); +fclose($file_handle); +$new_stat = stat($dirname); + +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stats +$affected_members = array(3, 9, 10, 'nlink', 'mtime', 'ctime'); +clearstatcache(); +var_dump(compare_stats($old_stat, $new_stat, $affected_members, "<")); + +echo "\n--- Done ---"; +?> +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation8/lstat_stat_variation8a.tmp"); +rmdir("$file_path/lstat_stat_variation8/lstat_stat_variation8_subdir/"); +rmdir("$file_path/lstat_stat_variation8"); +?> +--EXPECTF-- +*** Testing stat() on dir after subdir and file is created in it *** +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() on dir after subdir and file is created in it *** +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation12.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation12.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation12.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation12.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,73 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - effects of is_link() +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. lstat() not available on Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* test the effects of is_link() on stats of link */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +/* create temp file, link */ +$filename = "$file_path/lstat_stat_variation12.tmp"; +$fp = fopen($filename, "w"); // temp file +fclose($fp); + +$linkname = "$file_path/lstat_stat_variation12_link.tmp"; +symlink($filename, $linkname); // temp link + +// is_link() on a link +echo "*** Testing stat() on a link after using is_link() on it ***\n"; +$linkname = "$file_path/lstat_stat_variation12_link.tmp"; +$old_stat = lstat($linkname); +// clear the stat +clearstatcache(); +sleep(2); +var_dump( is_link($linkname) ); +$new_stat = lstat($linkname); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); +// clear the stat +clearstatcache(); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation12_link.tmp"); +unlink("$file_path/lstat_stat_variation12.tmp"); +?> +--EXPECTF-- +*** Testing stat() on a link after using is_link() on it *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() on a link after using is_link() on it *** +bool(true) +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation9.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation9.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation9.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation9.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,75 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - deleting file/subdir +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + +/* test the effects on stats by deleting file/subdir from a dir +*/ + +echo "*** Testing stat() for comparing stats after the deletion of subdir and file ***\n"; + +/* first create the dir/subdir and files, record the stat */ +@rmdir("$file_path/lstat_stat_variation9/"); // ensure that dir doesn't exists +mkdir("$file_path/lstat_stat_variation9/"); // temp dir + +// creating and deleting subdir and files in the dir +$dirname = "$file_path/lstat_stat_variation9"; +@rmdir("$dirname/lstat_stat_variation9_subdir"); // ensure that dir doesn't exists +mkdir("$dirname/lstat_stat_variation9_subdir"); +$file_handle = fopen("$dirname/lstat_stat_variation9a.tmp", "w"); +fclose($file_handle); + +$old_stat = stat($dirname); + +/* now delete teh surdir and file and record the stat */ +unlink("$dirname/lstat_stat_variation9a.tmp"); +rmdir("$dirname/lstat_stat_variation9_subdir"); + +// comparing stats after the deletion of subdir and file +$new_stat = stat($dirname); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); + +// compare the stats +$affected_members = array(3, 'nlink'); +var_dump(compare_stats($old_stat, $new_stat, $affected_members, ">")); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +$dirname = "$file_path/lstat_stat_variation9"; +rmdir($dirname); +?> +--EXPECTF-- +*** Testing stat() for comparing stats after the deletion of subdir and file *** +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Testing stat() for comparing stats after the deletion of subdir and file *** +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation13.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation13.phpt diff -u /dev/null php-src/ext/standard/tests/file/lstat_stat_variation13.phpt:1.2 --- /dev/null Thu Jul 26 13:55:42 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation13.phpt Thu Jul 26 13:55:42 2007 @@ -0,0 +1,64 @@ +--TEST-- +Test lstat() and stat() functions: usage variations - file opened using w and r mode +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. Not valid for Windows'); +} +?> +--FILE-- +<?php +/* Prototype: array lstat ( string $filename ); + Description: Gives information about a file or symbolic link + + Prototype: array stat ( string $filename ); + Description: Gives information about a file +*/ + +/* use stat on file created using "w" and "r" mode of fopen */ + +$file_path = dirname(__FILE__); +require "$file_path/file.inc"; + + +$filename = "$file_path/lstat_stat_variation13.tmp"; + +echo "*** Checking stat() on a file opened using read/write mode ***\n"; +$file_handle = fopen($filename, "w"); // create file +fclose($file_handle); +$old_stat = stat($filename); +// clear the stat +clearstatcache(); +sleep(2); +// opening file again in read mode +$file_handle = fopen($filename, "r"); // read file +fclose($file_handle); +$new_stat = stat($filename); +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); +// compare the stat +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); + +echo "\n--- Done ---"; +?> + +--CLEAN-- +<?php +$file_path = dirname(__FILE__); +unlink("$file_path/lstat_stat_variation13.tmp"); +?> +--EXPECTF-- +*** Checking stat() on a file opened using read/write mode *** +bool(true) +bool(true) +bool(true) + +--- Done --- +--UEXPECTF-- +*** Checking stat() on a file opened using read/write mode *** +bool(true) +bool(true) +bool(true) + +--- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation3.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation3.phpt diff -u php-src/ext/standard/tests/file/lstat_stat_variation3.phpt:1.1 php-src/ext/standard/tests/file/lstat_stat_variation3.phpt:1.2 --- php-src/ext/standard/tests/file/lstat_stat_variation3.phpt:1.1 Sat Jul 21 17:27:45 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation3.phpt Thu Jul 26 13:55:42 2007 @@ -1,10 +1,9 @@ --TEST-- -Test lstat() and stat() functions: usage variations - writing data in file & creating/deleting file/subdir - +Test lstat() and stat() functions: usage variations - effects of rename() on link --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. lstat() not available on Windows'); + die('skip.. Not valid for Windows'); } ?> --FILE-- @@ -16,68 +15,33 @@ Description: Gives information about a file */ -/* test the effects on the stats for writing to a file and - creating or deleting file/subdir from a dir -*/ +/* test the effects of rename() on stats of link */ $file_path = dirname(__FILE__); require "$file_path/file.inc"; - -/* create temp file, link and directory */ -mkdir("$file_path/lstat_stat_variation3/"); // temp dir - -$file_name = "$file_path/lstat_stat_variation3.tmp"; -$fp = fopen($file_name, "w"); // temp file +/* create temp file & link */ +$fp = fopen("$file_path/lstat_stat_variation3.tmp", "w"); // temp file fclose($fp); -symlink("$file_path/lstat_stat_variation3.tmp", "$file_path/lstat_stat_variation3_link.tmp"); // temp link +// temp link +symlink("$file_path/lstat_stat_variation3.tmp", "$file_path/lstat_stat_variation_link3.tmp"); -// writing to an empty file -echo "-- Testing stat() on file after data is written in it --\n"; -$fh = fopen($file_name,"w"); -$old_stat = stat($file_name); +// renaming a link +echo "*** Testing lstat() for link after being renamed ***\n"; +$old_linkname = "$file_path/lstat_stat_variation_link3.tmp"; +$new_linkname = "$file_path/lstat_stat_variation_link3a.tmp"; +$old_stat = lstat($old_linkname); clearstatcache(); -fwrite($fh, "Hello World"); -$new_stat = stat($file_name); +var_dump( rename($old_linkname, $new_linkname) ); +$new_stat = lstat($new_linkname); // compare self stats var_dump( compare_self_stat($old_stat) ); var_dump( compare_self_stat($new_stat) ); -// compare the stats -$comp_arr = array(7, 12, 'size', 'blocks'); -var_dump(compare_stats($old_stat, $new_stat, $comp_arr, "<")); -clearstatcache(); - -// creating and deleting subdir and files in the dir -echo "-- Testing stat() on dir after subdir and file is created in it --\n"; -$dirname = "$file_path/lstat_stat_variation3"; -$old_stat = stat($dirname); -clearstatcache(); -sleep(2); -mkdir("$dirname/lstat_stat_variation3_subdir"); -$file_handle = fopen("$dirname/lstat_stat_variation3a.tmp", "w"); -fclose($file_handle); -$new_stat = stat($dirname); -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); -// compare the stats -$affected_members = array(3, 9, 10, 'nlink', 'mtime', 'ctime'); -clearstatcache(); -var_dump(compare_stats($old_stat, $new_stat, $affected_members, "<")); -unlink("$dirname/lstat_stat_variation3a.tmp"); -rmdir("$dirname/lstat_stat_variation3_subdir"); - -// comparing stats after the deletion of subdir and file -echo "-- Testing stat() for comparing stats after the deletion of subdir and file --\n"; -$new_stat1 = stat($dirname); -// compare self stats -var_dump( compare_self_stat($new_stat1) ); -// compare the stats -$affected_members = array(3, 'nlink'); -var_dump(compare_stats($new_stat, $new_stat1, $affected_members, ">")); +// compare the two stats +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); echo "\n--- Done ---"; ?> @@ -86,38 +50,21 @@ <?php $file_path = dirname(__FILE__); unlink("$file_path/lstat_stat_variation3.tmp"); -rmdir("$file_path/lstat_stat_variation3"); -unlink("$file_path/lstat_stat_variation3_link.tmp"); +unlink("$file_path/lstat_stat_variation_link3a.tmp"); ?> --EXPECTF-- --- Testing stat() on file after data is written in it -- +*** Testing lstat() for link after being renamed *** bool(true) bool(true) bool(true) --- Testing stat() on dir after subdir and file is created in it -- -bool(true) -bool(true) -bool(true) --- Testing stat() for comparing stats after the deletion of subdir and file -- -bool(true) bool(true) --- Done --- - --UEXPECTF-- --- Testing stat() on file after data is written in it -- - -Notice: fwrite(): 11 character unicode buffer downcoded for binary stream runtime_encoding in %s on line %d +*** Testing lstat() for link after being renamed *** bool(true) bool(true) bool(true) --- Testing stat() on dir after subdir and file is created in it -- -bool(true) -bool(true) -bool(true) --- Testing stat() for comparing stats after the deletion of subdir and file -- -bool(true) bool(true) --- Done --- - http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation1.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation1.phpt diff -u php-src/ext/standard/tests/file/lstat_stat_variation1.phpt:1.1 php-src/ext/standard/tests/file/lstat_stat_variation1.phpt:1.2 --- php-src/ext/standard/tests/file/lstat_stat_variation1.phpt:1.1 Sat Jul 21 17:27:45 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation1.phpt Thu Jul 26 13:55:42 2007 @@ -1,9 +1,9 @@ --TEST-- -Test lstat() and stat() functions: usage variations - effects of rename() +Test lstat() and stat() functions: usage variations - effects of rename() on file --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. lstat() not available on Windows'); + die('skip.. Not valid for Windows'); } ?> --FILE-- @@ -15,23 +15,17 @@ Description: Gives information about a file */ -/* test the effects of rename() on stats of dir/file/link */ +/* test the effects of rename() on stats of file */ $file_path = dirname(__FILE__); require "$file_path/file.inc"; -/* create temp file, link and directory */ -mkdir("$file_path/lstat_stat_variation1/"); // temp dir +/* create temp file */ $fp = fopen("$file_path/lstat_stat_variation1.tmp", "w"); // temp file fclose($fp); -// temp link -symlink("$file_path/lstat_stat_variation1.tmp", "$file_path/lstat_stat_variation_link1.tmp"); - -echo "*** Checking lstat() and stat() on file, link and directory ater renaming them ***\n"; - -// renaming a file -echo "-- Testing stat() for files after being renamed --\n"; +// renaming a file and check stat +echo "*** Testing stat() for files after being renamed ***\n"; $file_path = dirname(__FILE__); $old_filename = "$file_path/lstat_stat_variation1.tmp"; $new_filename = "$file_path/lstat_stat_variation1a.tmp"; @@ -49,40 +43,6 @@ // clear the cache clearstatcache(); -// renaming a directory -echo "-- Testing stat() for directory after being renamed --\n"; -$old_dirname = "$file_path/lstat_stat_variation1"; -$new_dirname = "$file_path/lstat_stat_variation1a"; -$old_stat = stat($old_dirname); -clearstatcache(); -var_dump( rename($old_dirname, $new_dirname) ); -$new_stat = stat($new_dirname); - -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); - -// compare the two stats -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); -// clear the cache -clearstatcache(); - -// renaming a link -echo "-- Testing lstat() for link after being renamed --\n"; -$old_linkname = "$file_path/lstat_stat_variation_link1.tmp"; -$new_linkname = "$file_path/lstat_stat_variation_link1a.tmp"; -$old_stat = lstat($old_linkname); -clearstatcache(); -var_dump( rename($old_linkname, $new_linkname) ); -$new_stat = lstat($new_linkname); - -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); - -// compare the two stats -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); - echo "\n--- Done ---"; ?> @@ -90,22 +50,9 @@ <?php $file_path = dirname(__FILE__); unlink("$file_path/lstat_stat_variation1a.tmp"); -rmdir("$file_path/lstat_stat_variation1a"); -unlink("$file_path/lstat_stat_variation_link1a.tmp"); ?> --EXPECTF-- -*** Checking lstat() and stat() on file, link and directory ater renaming them *** --- Testing stat() for files after being renamed -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing stat() for directory after being renamed -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing lstat() for link after being renamed -- +*** Testing stat() for files after being renamed *** bool(true) bool(true) bool(true) @@ -113,18 +60,7 @@ --- Done --- --UEXPECTF-- -*** Checking lstat() and stat() on file, link and directory ater renaming them *** --- Testing stat() for files after being renamed -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing stat() for directory after being renamed -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing lstat() for link after being renamed -- +*** Testing stat() for files after being renamed *** bool(true) bool(true) bool(true) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation4.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation4.phpt diff -u php-src/ext/standard/tests/file/lstat_stat_variation4.phpt:1.1 php-src/ext/standard/tests/file/lstat_stat_variation4.phpt:1.2 --- php-src/ext/standard/tests/file/lstat_stat_variation4.phpt:1.1 Sat Jul 21 17:27:45 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation4.phpt Thu Jul 26 13:55:42 2007 @@ -1,10 +1,9 @@ --TEST-- -Test lstat() and stat() functions: usage variations - effects of is_dir(), is_file() and is_link() - +Test lstat() and stat() functions: usage variations - effects of touch() on file --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. lstat() not available on Windows'); + die('skip.. Not valid for Windows'); } ?> --FILE-- @@ -16,107 +15,35 @@ Description: Gives information about a file */ -/* test the effects of is_dir(), is_file() & is_link() on the stats of dir/file/link */ +/* test the effects of touch() on stats of file */ $file_path = dirname(__FILE__); require "$file_path/file.inc"; -/* create temp file, link and directory */ -$dirname = "$file_path/lstat_stat_variation4"; -mkdir($dirname); // temp dir +/* create temp file */ -$filename = "$file_path/lstat_stat_variation4.tmp"; -$fp = fopen($filename, "w"); // temp file +$file_name = "$file_path/lstat_stat_variation4.tmp"; +$fp = fopen($file_name, "w"); // temp file fclose($fp); -$linkname = "$file_path/lstat_stat_variation4_link.tmp"; -symlink($filename, $linkname); // temp link - -echo "\n*** Checking lstat() and stat() on file, link and directory after accessing it - with is_dir(), is_file() and is_link() functions ***\n"; - -// is_dir() on a directory -echo "-- Testing on Directory --\n"; -$old_stat = stat($dirname); +// touch a file check stat, there should be difference in atime +echo "*** Testing stat() for file after using touch() on the file ***\n"; +$old_stat = stat($file_name); // clear the cache clearstatcache(); sleep(2); -var_dump( is_dir($dirname) ); -$new_stat = stat($dirname); +var_dump( touch($file_name) ); +$new_stat = stat($file_name); // compare self stats var_dump( compare_self_stat($old_stat) ); var_dump( compare_self_stat($new_stat) ); -// compare the stat -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); -// clear the stat -clearstatcache(); - -// is_file() on a file -echo "-- Testing on file --\n"; -$old_stat = stat($filename); -// clear the stat -clearstatcache(); -sleep(2); -var_dump( is_file($filename) ); -$new_stat = stat($filename); -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); // compare the stat -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); -// clear the stat -clearstatcache(); - -// is_link() on a link -echo "-- Testing on link --\n"; -$linkname = "$file_path/lstat_stat_variation4_link.tmp"; -$old_stat = lstat($linkname); -// clear the stat -clearstatcache(); -sleep(2); -var_dump( is_link($linkname) ); -$new_stat = lstat($linkname); -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); -// compare the stat -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); -// clear the stat -clearstatcache(); - -echo "\n*** Checking stat() on a file with read/write permission ***\n"; -$file_handle = fopen($filename, "w"); // create file -fclose($file_handle); -$old_stat = stat($filename); -// clear the stat -clearstatcache(); -sleep(2); -// opening file again in read mode -$file_handle = fopen($filename, "r"); // read file -fclose($file_handle); -$new_stat = stat($filename); -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); -// compare the stat -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); -// clear the stat -clearstatcache(); - -echo "\n*** Checking lstat() and stat() on hard link ***\n"; -$linkname = "$file_path/lstat_stat_variation4_hard.tmp"; -var_dump( link($filename, $linkname) ); -$file_stat = stat($filename); -$link_stat = lstat($linkname); -// compare self stats -var_dump( compare_self_stat($file_stat) ); -var_dump( compare_self_stat($link_stat) ); -// compare the stat -var_dump( compare_stats($file_stat, $link_stat, $all_stat_keys) ); -// clear the stat +$affected_members = array(8, 'atime'); +var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); +// clear the cache clearstatcache(); echo "\n--- Done ---"; @@ -125,36 +52,10 @@ --CLEAN-- <?php $file_path = dirname(__FILE__); -unlink("$file_path/lstat_stat_variation4_hard.tmp"); -unlink("$file_path/lstat_stat_variation4_link.tmp"); unlink("$file_path/lstat_stat_variation4.tmp"); -rmdir("$file_path/lstat_stat_variation4"); ?> --EXPECTF-- -*** Checking lstat() and stat() on file, link and directory after accessing it - with is_dir(), is_file() and is_link() functions *** --- Testing on Directory -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing on file -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing on link -- -bool(true) -bool(true) -bool(true) -bool(true) - -*** Checking stat() on a file with read/write permission *** -bool(true) -bool(true) -bool(true) - -*** Checking lstat() and stat() on hard link *** +*** Testing stat() for file after using touch() on the file *** bool(true) bool(true) bool(true) @@ -162,30 +63,7 @@ --- Done --- --UEXPECTF-- -*** Checking lstat() and stat() on file, link and directory after accessing it - with is_dir(), is_file() and is_link() functions *** --- Testing on Directory -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing on file -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing on link -- -bool(true) -bool(true) -bool(true) -bool(true) - -*** Checking stat() on a file with read/write permission *** -bool(true) -bool(true) -bool(true) - -*** Checking lstat() and stat() on hard link *** +*** Testing stat() for file after using touch() on the file *** bool(true) bool(true) bool(true) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation5.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation5.phpt diff -u php-src/ext/standard/tests/file/lstat_stat_variation5.phpt:1.1 php-src/ext/standard/tests/file/lstat_stat_variation5.phpt:1.2 --- php-src/ext/standard/tests/file/lstat_stat_variation5.phpt:1.1 Sat Jul 21 17:27:45 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation5.phpt Thu Jul 26 13:55:42 2007 @@ -1,11 +1,12 @@ --TEST-- -Test lstat() and stat() functions: usage variations - effects with changing permissions +Test lstat() and stat() functions: usage variations - effects of touch() on dir --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. lstat() not available on Windows'); + die('skip.. Not valid for Windows'); } ?> +?> --FILE-- <?php /* Prototype: array lstat ( string $filename ); @@ -15,73 +16,36 @@ Description: Gives information about a file */ -/* test for effects on stats with changing permissions of dir/file/link */ +/* test the effects of touch() on stats of dir */ $file_path = dirname(__FILE__); require "$file_path/file.inc"; -/* create temp file, link and directory */ -mkdir("$file_path/lstat_stat_variation5/"); // temp dir +/* create temp directory */ -$filename = "$file_path/lstat_stat_variation5.tmp"; -$fp = fopen($filename, "w"); // temp file -fclose($fp); - -// temp link -$linkname = "$file_path/lstat_stat_variation5_link.tmp"; -symlink($filename, $linkname); - -/* Checking lstat() and stat() on file, link and directory after changing permission */ - -// checking lstat() and stat() on links -echo "\n*** Testing lstat() and stat() on links with miscelleneous file permission and content ***\n"; -$old_stat = lstat($linkname); -var_dump( chmod($linkname, 0777) ); -// clear the stat +$dir_name = "$file_path/lstat_stat_variation5"; +@rmdir($dir_name); //ensure that dir doesn't exists +mkdir($dir_name); // temp dir + +// touch a directory and check stat, there should be difference in atime +echo "*** Testing stat() for directory after using touch() on the directory ***\n"; +$old_stat = stat($dir_name); +// clear the cache clearstatcache(); sleep(2); -$new_stat = lstat($linkname); -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); -// compare the stat -var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys, "=") ); -// clear the stat -clearstatcache(); +var_dump( touch($dir_name) ); +$new_stat = stat($dir_name); -// checking stat() on file -echo "\n*** Testing lstat() and stat() on file with miscelleneous file permission and content ***\n"; -$old_stat = stat($filename); -var_dump( chmod($filename, 0777) ); -// clear the stat -clearstatcache(); -sleep(2); -$new_stat = stat($filename); // compare self stats var_dump( compare_self_stat($old_stat) ); var_dump( compare_self_stat($new_stat) ); + // compare the stat -$affected_members = array(10, 'ctime'); -var_dump( compare_stats($old_stat, $new_stat, $affected_members, "!=") ); -// clear the stat -clearstatcache(); // clear statement cache - -// checking stat() on directory -echo "\n*** Testing stat() on directory with miscelleneous file permission ***\n"; -$dirname = "$file_path/lstat_stat_variation5"; -$old_stat = stat($dirname); -var_dump( chmod($dirname, 0777) ); -// clear the stat +$affected_members = array(8, 9, 10, 'atime', 'mtime', 'ctime'); +var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); +// clear the cache clearstatcache(); -sleep(2); -$new_stat = stat($dirname); -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); -// compare the stat -$affected_members = array(2, 10, 'mode', 'ctime'); -var_dump( compare_stats($old_stat, $new_stat, $affected_members, "!=") ); echo "\n--- Done ---"; ?> @@ -89,24 +53,10 @@ --CLEAN-- <?php $file_path = dirname(__FILE__); -unlink("$file_path/lstat_stat_variation5_link.tmp"); -unlink("$file_path/lstat_stat_variation5.tmp"); rmdir("$file_path/lstat_stat_variation5"); ?> --EXPECTF-- -*** Testing lstat() and stat() on links with miscelleneous file permission and content *** -bool(true) -bool(true) -bool(true) -bool(true) - -*** Testing lstat() and stat() on file with miscelleneous file permission and content *** -bool(true) -bool(true) -bool(true) -bool(true) - -*** Testing stat() on directory with miscelleneous file permission *** +*** Testing stat() for directory after using touch() on the directory *** bool(true) bool(true) bool(true) @@ -114,19 +64,7 @@ --- Done --- --UEXPECTF-- -*** Testing lstat() and stat() on links with miscelleneous file permission and content *** -bool(true) -bool(true) -bool(true) -bool(true) - -*** Testing lstat() and stat() on file with miscelleneous file permission and content *** -bool(true) -bool(true) -bool(true) -bool(true) - -*** Testing stat() on directory with miscelleneous file permission *** +*** Testing stat() for directory after using touch() on the directory *** bool(true) bool(true) bool(true) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation6.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation6.phpt diff -u php-src/ext/standard/tests/file/lstat_stat_variation6.phpt:1.1 php-src/ext/standard/tests/file/lstat_stat_variation6.phpt:1.2 --- php-src/ext/standard/tests/file/lstat_stat_variation6.phpt:1.1 Sat Jul 21 17:27:45 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation6.phpt Thu Jul 26 13:55:42 2007 @@ -1,5 +1,5 @@ --TEST-- -Test lstat() and stat() functions: usage variations - dir/file/link names stored in objects +Test lstat() and stat() functions: usage variations - effects of touch() on link --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') { @@ -15,65 +15,38 @@ Description: Gives information about a file */ -/* test for stats when names of dir/file/link are stored in objects */ +/* test the effects of touch() on stats of link */ $file_path = dirname(__FILE__); require "$file_path/file.inc"; /* create temp file, link and directory */ -mkdir("$file_path/lstat_stat_variation6/"); // temp dir -$fp = fopen("$file_path/lstat_stat_variation6.tmp", "w"); // temp file +$file_name = "$file_path/lstat_stat_variation6.tmp"; +$fp = fopen($file_name, "w"); // temp file fclose($fp); +$link_name = "$file_path/lstat_stat_variation_link6.tmp"; +symlink($file_name, $link_name); // temp link -// temp link -symlink("$file_path/lstat_stat_variation6.tmp", "$file_path/lstat_stat_variation6_link.tmp"); - -/* Checking lstat() and stat() on file/link/directory where filenames, - linknames and directory names are stored in object and array */ - -echo "\n*** Testing lstat() and stat() with filename, linkname - and directory name stored inside a object ***\n"; - -// creating object with members as numeric and non-numeric filename, linkname and directory name -class object_temp { - public $var_name; - public function object_temp($name) { - $this->var_name = $name; - } -} -// directory as member -$obj1 = new object_temp("$file_path/lstat_stat_variation6/"); -$obj2 = new object_temp("$file_path/lstat_stat_variation6a/"); - -// file as member -$obj3 = new object_temp("$file_path/lstat_stat_variation6.tmp"); -$obj4 = new object_temp("$file_path/lstat_stat_variation6a.tmp"); - -// link as member -$obj5 = new object_temp("$file_path/lstat_stat_variation6_link.tmp"); -$obj6 = new object_temp("$file_path/lstat_stat_variation6a_link.tmp"); - -echo "\n-- Testing lstat() and stat() with softlink, linkname stored inside an object --\n"; - -var_dump( lstat($obj5->var_name) ); - -var_dump( symlink($obj5->var_name, $obj6->var_name) ); -var_dump( lstat($obj6->var_name) ); - -echo "\n-- Testing stat() on filename stored inside an object --\n"; -var_dump( stat($obj3->var_name) ); - -$fp = fopen("$file_path/lstat_stat_variation6a.tmp", "w"); -fclose($fp); -var_dump( stat($obj4->var_name) ); - -echo "\n-- Testing stat() on directory name stored inside an object --\n"; -var_dump( stat($obj1->var_name) ); - -mkdir("$file_path/lstat_stat_variation6a/"); -var_dump( stat($obj2->var_name) ); +// touch a link, check stat, there should be difference in atime +echo "*** Testing lstat() for link after using touch() on the link ***\n"; +$old_stat = lstat($link_name); +// clear the cache +clearstatcache(); +sleep(2); +var_dump( touch($link_name) ); +$new_stat = lstat($link_name); + +// compare self stats +var_dump( compare_self_stat($old_stat) ); +var_dump( compare_self_stat($new_stat) ); + +// compare the stat +$affected_members = array(8, 'atime'); +var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); +// clear the stat +clearstatcache(); echo "\n--- Done ---"; ?> @@ -81,683 +54,22 @@ --CLEAN-- <?php $file_path = dirname(__FILE__); -unlink("$file_path/lstat_stat_variation6_link.tmp"); unlink("$file_path/lstat_stat_variation6.tmp"); -rmdir("$file_path/lstat_stat_variation6"); -unlink("$file_path/lstat_stat_variation6a_link.tmp"); -unlink("$file_path/lstat_stat_variation6a.tmp"); -rmdir("$file_path/lstat_stat_variation6a/"); +unlink("$file_path/lstat_stat_variation_link6.tmp"); ?> - --EXPECTF-- -*** Testing lstat() and stat() with filename, linkname - and directory name stored inside a object *** - --- Testing lstat() and stat() with softlink, linkname stored inside an object -- -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - ["dev"]=> - int(%d) - ["ino"]=> - int(%d) - ["mode"]=> - int(%d) - ["nlink"]=> - int(%d) - ["uid"]=> - int(%d) - ["gid"]=> - int(%d) - ["rdev"]=> - int(%d) - ["size"]=> - int(%d) - ["atime"]=> - int(%d) - ["mtime"]=> - int(%d) - ["ctime"]=> - int(%d) - ["blksize"]=> - int(%d) - ["blocks"]=> - int(%d) -} +*** Testing lstat() for link after using touch() on the link *** +bool(true) +bool(true) +bool(true) bool(true) -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - ["dev"]=> - int(%d) - ["ino"]=> - int(%d) - ["mode"]=> - int(%d) - ["nlink"]=> - int(%d) - ["uid"]=> - int(%d) - ["gid"]=> - int(%d) - ["rdev"]=> - int(%d) - ["size"]=> - int(%d) - ["atime"]=> - int(%d) - ["mtime"]=> - int(%d) - ["ctime"]=> - int(%d) - ["blksize"]=> - int(%d) - ["blocks"]=> - int(%d) -} - --- Testing stat() on filename stored inside an object -- -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - ["dev"]=> - int(%d) - ["ino"]=> - int(%d) - ["mode"]=> - int(%d) - ["nlink"]=> - int(%d) - ["uid"]=> - int(%d) - ["gid"]=> - int(%d) - ["rdev"]=> - int(%d) - ["size"]=> - int(%d) - ["atime"]=> - int(%d) - ["mtime"]=> - int(%d) - ["ctime"]=> - int(%d) - ["blksize"]=> - int(%d) - ["blocks"]=> - int(%d) -} -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - ["dev"]=> - int(%d) - ["ino"]=> - int(%d) - ["mode"]=> - int(%d) - ["nlink"]=> - int(%d) - ["uid"]=> - int(%d) - ["gid"]=> - int(%d) - ["rdev"]=> - int(%d) - ["size"]=> - int(%d) - ["atime"]=> - int(%d) - ["mtime"]=> - int(%d) - ["ctime"]=> - int(%d) - ["blksize"]=> - int(%d) - ["blocks"]=> - int(%d) -} - --- Testing stat() on directory name stored inside an object -- -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - ["dev"]=> - int(%d) - ["ino"]=> - int(%d) - ["mode"]=> - int(%d) - ["nlink"]=> - int(%d) - ["uid"]=> - int(%d) - ["gid"]=> - int(%d) - ["rdev"]=> - int(%d) - ["size"]=> - int(%d) - ["atime"]=> - int(%d) - ["mtime"]=> - int(%d) - ["ctime"]=> - int(%d) - ["blksize"]=> - int(%d) - ["blocks"]=> - int(%d) -} -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - ["dev"]=> - int(%d) - ["ino"]=> - int(%d) - ["mode"]=> - int(%d) - ["nlink"]=> - int(%d) - ["uid"]=> - int(%d) - ["gid"]=> - int(%d) - ["rdev"]=> - int(%d) - ["size"]=> - int(%d) - ["atime"]=> - int(%d) - ["mtime"]=> - int(%d) - ["ctime"]=> - int(%d) - ["blksize"]=> - int(%d) - ["blocks"]=> - int(%d) -} --- Done --- --UEXPECTF-- -*** Testing lstat() and stat() with filename, linkname - and directory name stored inside a object *** - --- Testing lstat() and stat() with softlink, linkname stored inside an object -- -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - [u"dev"]=> - int(%d) - [u"ino"]=> - int(%d) - [u"mode"]=> - int(%d) - [u"nlink"]=> - int(%d) - [u"uid"]=> - int(%d) - [u"gid"]=> - int(%d) - [u"rdev"]=> - int(%d) - [u"size"]=> - int(%d) - [u"atime"]=> - int(%d) - [u"mtime"]=> - int(%d) - [u"ctime"]=> - int(%d) - [u"blksize"]=> - int(%d) - [u"blocks"]=> - int(%d) -} +*** Testing lstat() for link after using touch() on the link *** +bool(true) +bool(true) +bool(true) bool(true) -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - [u"dev"]=> - int(%d) - [u"ino"]=> - int(%d) - [u"mode"]=> - int(%d) - [u"nlink"]=> - int(%d) - [u"uid"]=> - int(%d) - [u"gid"]=> - int(%d) - [u"rdev"]=> - int(%d) - [u"size"]=> - int(%d) - [u"atime"]=> - int(%d) - [u"mtime"]=> - int(%d) - [u"ctime"]=> - int(%d) - [u"blksize"]=> - int(%d) - [u"blocks"]=> - int(%d) -} - --- Testing stat() on filename stored inside an object -- -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - [u"dev"]=> - int(%d) - [u"ino"]=> - int(%d) - [u"mode"]=> - int(%d) - [u"nlink"]=> - int(%d) - [u"uid"]=> - int(%d) - [u"gid"]=> - int(%d) - [u"rdev"]=> - int(%d) - [u"size"]=> - int(%d) - [u"atime"]=> - int(%d) - [u"mtime"]=> - int(%d) - [u"ctime"]=> - int(%d) - [u"blksize"]=> - int(%d) - [u"blocks"]=> - int(%d) -} -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - [u"dev"]=> - int(%d) - [u"ino"]=> - int(%d) - [u"mode"]=> - int(%d) - [u"nlink"]=> - int(%d) - [u"uid"]=> - int(%d) - [u"gid"]=> - int(%d) - [u"rdev"]=> - int(%d) - [u"size"]=> - int(%d) - [u"atime"]=> - int(%d) - [u"mtime"]=> - int(%d) - [u"ctime"]=> - int(%d) - [u"blksize"]=> - int(%d) - [u"blocks"]=> - int(%d) -} - --- Testing stat() on directory name stored inside an object -- -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - [u"dev"]=> - int(%d) - [u"ino"]=> - int(%d) - [u"mode"]=> - int(%d) - [u"nlink"]=> - int(%d) - [u"uid"]=> - int(%d) - [u"gid"]=> - int(%d) - [u"rdev"]=> - int(%d) - [u"size"]=> - int(%d) - [u"atime"]=> - int(%d) - [u"mtime"]=> - int(%d) - [u"ctime"]=> - int(%d) - [u"blksize"]=> - int(%d) - [u"blocks"]=> - int(%d) -} -array(26) { - [0]=> - int(%d) - [1]=> - int(%d) - [2]=> - int(%d) - [3]=> - int(%d) - [4]=> - int(%d) - [5]=> - int(%d) - [6]=> - int(%d) - [7]=> - int(%d) - [8]=> - int(%d) - [9]=> - int(%d) - [10]=> - int(%d) - [11]=> - int(%d) - [12]=> - int(%d) - [u"dev"]=> - int(%d) - [u"ino"]=> - int(%d) - [u"mode"]=> - int(%d) - [u"nlink"]=> - int(%d) - [u"uid"]=> - int(%d) - [u"gid"]=> - int(%d) - [u"rdev"]=> - int(%d) - [u"size"]=> - int(%d) - [u"atime"]=> - int(%d) - [u"mtime"]=> - int(%d) - [u"ctime"]=> - int(%d) - [u"blksize"]=> - int(%d) - [u"blocks"]=> - int(%d) -} --- Done --- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/file.inc?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/standard/tests/file/file.inc diff -u php-src/ext/standard/tests/file/file.inc:1.6 php-src/ext/standard/tests/file/file.inc:1.7 --- php-src/ext/standard/tests/file/file.inc:1.6 Fri Jul 20 18:09:11 2007 +++ php-src/ext/standard/tests/file/file.inc Thu Jul 26 13:55:42 2007 @@ -548,7 +548,7 @@ foreach($string_keys as $str_key) { if($stat[$key] != $stat[$str_key]) { - echo "stat[$key] doesn't match with stat[$str_key]\n"; + echo "Error: stat[$key] doesn't match with stat[$str_key]\n"; $flag = false; $key++; } @@ -557,6 +557,13 @@ } } // end of foreach + // if the $return_value is false, i.e all the element do not match then + // dump the stat array so that its easy to figure out the error + if ($return_value == false ) { + echo "\n Dumping stat array ...\n"; + var_dump($stat); + } + return $return_value; }// end of compare_self_stat @@ -597,7 +604,7 @@ case "==": if ( $stat1[ $fields[$index] ] != $stat2[ $fields[$index] ] ) { $result = false; - echo "stat1 do not match with stat2 at key value: $fields[$index]\n"; + echo "Error: stat1 do not match with stat2 at key value: $fields[$index]\n"; } break; @@ -606,25 +613,34 @@ // do nothing as its not equal, else will take care of if equal } else { $result = false; - echo "stat1 equals stat2 at key value: $fields[$index]\n"; + echo "Error: stat1 equals stat2 at key value: $fields[$index]\n"; } break; case ">": if ( $stat1[ $fields[$index] ] <= $stat2[ $fields[$index] ] ) { $result = false; - echo "stat1 is not greater than stat2 at key value: $fields[$index]\n"; + echo "Error: stat1 is not greater than stat2 at key value: $fields[$index]\n"; } break; case "<": if ( $stat1[ $fields[$index] ] >= $stat2[ $fields[$index] ] ) { $result = false; - echo "stat1 is not lesser than stat2 at key value: $fields[$index]\n"; + echo "Error: stat1 is not lesser than stat2 at key value: $fields[$index]\n"; } break; } } + // if the result is false(i.e values are not as expected), + // dump the stat array so that easy to figure out the error + if ( $result == false ) { + echo "\n Dumping stat array 1...\n"; + var_dump($stat1); + echo "\n Dumping stat array 2...\n"; + var_dump($stat2); + } + return $result; } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/lstat_stat_variation2.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/lstat_stat_variation2.phpt diff -u php-src/ext/standard/tests/file/lstat_stat_variation2.phpt:1.1 php-src/ext/standard/tests/file/lstat_stat_variation2.phpt:1.2 --- php-src/ext/standard/tests/file/lstat_stat_variation2.phpt:1.1 Sat Jul 21 17:27:45 2007 +++ php-src/ext/standard/tests/file/lstat_stat_variation2.phpt Thu Jul 26 13:55:42 2007 @@ -1,9 +1,9 @@ --TEST-- -Test lstat() and stat() functions: usage variations - effects of touch() +Test lstat() and stat() functions: usage variations - effects of rename() on dir --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. lstat() not available on Windows'); + die('skip.. Not valid for Windows'); } ?> --FILE-- @@ -15,106 +15,43 @@ Description: Gives information about a file */ -/* test the effects of touch() on the stats of dir/file/link */ +/* test the effects of rename() on stats of dir */ $file_path = dirname(__FILE__); -require "$file_path/file.inc"; +require("file.inc"); - -/* create temp file, link and directory */ - -$dir_name = "$file_path/lstat_stat_variation2/"; -mkdir($dir_name); // temp dir -$file_name = "$file_path/lstat_stat_variation2.tmp"; -$fp = fopen($file_name, "w"); // temp file -fclose($fp); -$link_name = "$file_path/lstat_stat_variation_link2.tmp"; -symlink($file_name, $link_name); // temp link - - -echo "\n*** Checking lstat() and stat() on file, link and directory after touching them ***\n"; - -// touch a file -echo "-- Testing stat() for file after using touch() on the file --\n"; -$old_stat = stat($file_name); -// clear the cache +/* create temp directory */ +@rmdir("$file_path/lstat_stat_variation2/"); //ensure that dir doesn't exists +mkdir("$file_path/lstat_stat_variation2/"); // temp dir + +// renaming a directory and check stat +echo "*** Testing stat() for directory after being renamed ***\n"; +$old_dirname = "$file_path/lstat_stat_variation2"; +$new_dirname = "$file_path/lstat_stat_variation2a"; +$old_stat = stat($old_dirname); clearstatcache(); -sleep(2); -var_dump( touch($file_name) ); -$new_stat = stat($file_name); +var_dump( rename($old_dirname, $new_dirname) ); +$new_stat = stat($new_dirname); // compare self stats var_dump( compare_self_stat($old_stat) ); var_dump( compare_self_stat($new_stat) ); -// compare the stat -$affected_members = array(8, 'atime'); -var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); +// compare the two stats +var_dump( compare_stats($old_stat, $new_stat, $all_stat_keys) ); // clear the cache clearstatcache(); - -// touch a directory -echo "-- Testing stat() for directory after using touch() on the directory --\n"; -$old_stat = stat($dir_name); -// clear the cache -clearstatcache(); -sleep(2); -var_dump( touch($dir_name) ); -$new_stat = stat($dir_name); - -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); - -// compare the stat -$affected_members = array(8, 9, 10, 'atime', 'mtime', 'ctime'); -var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); -// clear the cache -clearstatcache(); - -// touch a link -echo "-- Testing lstat() for link after using touch() on the link --\n"; -$old_stat = lstat($link_name); -// clear the cache -clearstatcache(); -sleep(2); -var_dump( touch($link_name) ); -$new_stat = lstat($link_name); - -// compare self stats -var_dump( compare_self_stat($old_stat) ); -var_dump( compare_self_stat($new_stat) ); - -// compare the stat -$affected_members = array(8, 'atime'); -var_dump( compare_stats($old_stat, $new_stat, $affected_members, "<") ); -// clear the stat -clearstatcache(); - echo "\n--- Done ---"; ?> --CLEAN-- <?php $file_path = dirname(__FILE__); -unlink("$file_path/lstat_stat_variation2.tmp"); -rmdir("$file_path/lstat_stat_variation2"); -unlink("$file_path/lstat_stat_variation_link2.tmp"); +rmdir("$file_path/lstat_stat_variation2a"); ?> --EXPECTF-- -*** Checking lstat() and stat() on file, link and directory after touching them *** --- Testing stat() for file after using touch() on the file -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing stat() for directory after using touch() on the directory -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing lstat() for link after using touch() on the link -- +*** Testing stat() for directory after being renamed *** bool(true) bool(true) bool(true) @@ -122,18 +59,7 @@ --- Done --- --UEXPECTF-- -*** Checking lstat() and stat() on file, link and directory after touching them *** --- Testing stat() for file after using touch() on the file -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing stat() for directory after using touch() on the directory -- -bool(true) -bool(true) -bool(true) -bool(true) --- Testing lstat() for link after using touch() on the link -- +*** Testing stat() for directory after being renamed *** bool(true) bool(true) bool(true)