forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
ext/standard/tests/dir/scandir_error2_throw_on_error_declare.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--TEST-- | ||
Test scandir() function error conditions with throw on error declare enabled - Non-existent directory | ||
--SKIPIF-- | ||
<?php | ||
if (substr(PHP_OS, 0, 3) == 'WIN') { | ||
die('skip.. Not valid for Windows'); | ||
} | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
declare(throw_on_error=1); | ||
|
||
echo "*** Testing scandir() : error conditions ***\n"; | ||
$directory = __DIR__ . '/idonotexist'; | ||
|
||
echo "\n-- Pass scandir() an absolute path that does not exist --\n"; | ||
try { | ||
var_dump(scandir($directory)); | ||
} catch (\FileSystemError $e) { | ||
echo $e->getMessage() . \PHP_EOL; | ||
} | ||
|
||
echo "\n-- Pass scandir() a relative path that does not exist --\n"; | ||
try { | ||
var_dump(scandir('/idonotexist')); | ||
} catch (\FileSystem $e) { | ||
echo $e->getMessage() . \PHP_EOL; | ||
} | ||
?> | ||
--EXPECT-- | ||
*** Testing scandir() : error conditions *** | ||
|
||
-- Pass scandir() an absolute path that does not exist -- | ||
(errno 2): No such file or directory | ||
|
||
-- Pass scandir() a relative path that does not exist -- | ||
(errno 2): No such file or directory |