diff options
author | Jani Taskinen <jani@php.net> | 2007-08-13 08:14:03 +0000 |
---|---|---|
committer | Jani Taskinen <jani@php.net> | 2007-08-13 08:14:03 +0000 |
commit | bdd54e7c9ba9365d6f08fb6a06fe76475d380c4b (patch) | |
tree | ed775cb139f5c465fe8be0f114423936c70671d2 | |
parent | 13ec50a7e4acdbc1b3c7caad0800069e0ca14cab (diff) | |
download | php-git-bdd54e7c9ba9365d6f08fb6a06fe76475d380c4b.tar.gz |
MFB: Fix tests + directory check inside copy() function
-rw-r--r-- | ext/standard/file.c | 6 | ||||
-rw-r--r-- | ext/standard/tests/assert/assert_basic2.phpt | 2 | ||||
-rw-r--r-- | ext/standard/tests/file/copy_variation12.phpt | 12 | ||||
-rw-r--r-- | ext/standard/tests/file/copy_variation13.phpt | 6 |
4 files changed, 17 insertions, 9 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index e46fe8a26e..5e95f1e09d 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1903,13 +1903,13 @@ PHPAPI int php_copy_file_ex(char *src, char *dest, int src_chk TSRMLS_DC) default: /* failed to stat file, does not exist? */ return ret; } - if (php_stream_stat_path_ex(dest, PHP_STREAM_URL_STAT_QUIET, &dest_s, NULL) != 0) { - goto safe_to_copy; - } if (S_ISDIR(src_s.sb.st_mode)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument to copy() function cannot be a directory"); return FAILURE; } + if (php_stream_stat_path_ex(dest, PHP_STREAM_URL_STAT_QUIET, &dest_s, NULL) != 0) { + goto safe_to_copy; + } if (!src_s.sb.st_ino || !dest_s.sb.st_ino) { goto no_stat; } diff --git a/ext/standard/tests/assert/assert_basic2.phpt b/ext/standard/tests/assert/assert_basic2.phpt index 1223a680c6..51ab621830 100644 --- a/ext/standard/tests/assert/assert_basic2.phpt +++ b/ext/standard/tests/assert/assert_basic2.phpt @@ -1,5 +1,5 @@ --TEST-- -assert() basic - correct call back values before and after assert. +assert() - basic - correct call back values before and after assert. --INI-- assert.active = 1 assert.warning = 1 diff --git a/ext/standard/tests/file/copy_variation12.phpt b/ext/standard/tests/file/copy_variation12.phpt index 14f09f2eaf..38e4609e9b 100644 --- a/ext/standard/tests/file/copy_variation12.phpt +++ b/ext/standard/tests/file/copy_variation12.phpt @@ -41,15 +41,23 @@ rmdir(dirname(__FILE__)."/copy_variation12"); --EXPECTF-- *** Test copy() function: Trying to create a copy of an existing dir *** + +Warning: copy(): The first argument to copy() function cannot be a directory in %s/copy_variation12.php on line %d bool(false) bool(false) int(4096) -int(0) + +Warning: filesize(): stat failed for %s/copy_copy_variation12 in %s/copy_variation12.php on line %d +bool(false) *** Done *** --UEXPECTF-- *** Test copy() function: Trying to create a copy of an existing dir *** + +Warning: copy(): The first argument to copy() function cannot be a directory in %s/copy_variation12.php on line %d bool(false) bool(false) int(4096) -int(0) + +Warning: filesize(): stat failed for %s/copy_copy_variation12 in %s/copy_variation12.php on line %d +bool(false) *** Done *** diff --git a/ext/standard/tests/file/copy_variation13.phpt b/ext/standard/tests/file/copy_variation13.phpt index fb3fb6374c..e323a8eb00 100644 --- a/ext/standard/tests/file/copy_variation13.phpt +++ b/ext/standard/tests/file/copy_variation13.phpt @@ -1,5 +1,5 @@ --TEST-- -Test copy() function: usage variations - src as dir and dest as an existing file(Bug #42243) +Test copy() function: usage variations - src as dir and dest as an existing file (Bug #42243) --FILE-- <?php /* Prototype: bool copy ( string $source, string $dest ); @@ -44,7 +44,7 @@ rmdir(dirname(__FILE__)."/copy_variation13"); *** Test copy() function: Trying to copy dir to file *** *** Testing copy() in copying dir to file *** -Warning: copy(%s): %s +Warning: copy(): The first argument to copy() function cannot be a directory in %s/copy_variation13.php on line %d bool(false) bool(true) bool(true) @@ -59,7 +59,7 @@ int(%d) *** Test copy() function: Trying to copy dir to file *** *** Testing copy() in copying dir to file *** -Warning: copy(%s): %s +Warning: copy(): The first argument to copy() function cannot be a directory in %s/copy_variation13.php on line %d bool(false) bool(true) bool(true) |