mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
ext/standard: Deprecate passing null to readdir(), rewinddir(), and closedir() (#19423)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_null_to_readdir_rewinddir_and_closedir
This commit is contained in:
committed by
GitHub
parent
ba21ab4ea0
commit
dc0962c243
@@ -160,6 +160,8 @@ PHP_FUNCTION(dir)
|
||||
static php_stream* php_dir_get_directory_stream_from_user_arg(php_stream *dir_stream)
|
||||
{
|
||||
if (dir_stream == NULL) {
|
||||
php_error_docref(NULL, E_DEPRECATED,
|
||||
"Passing null is deprecated, instead the last opened directory stream should be provided");
|
||||
if (UNEXPECTED(DIRG(default_dir) == NULL)) {
|
||||
zend_type_error("No resource supplied");
|
||||
return NULL;
|
||||
|
||||
@@ -44,6 +44,8 @@ rmdir($dir_path);
|
||||
*** Testing closedir() : basic functionality ***
|
||||
|
||||
-- Call closedir() with no arguments: --
|
||||
|
||||
Deprecated: closedir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
NULL
|
||||
-- Check Directory Handle: --
|
||||
resource(%d) of type (Unknown)
|
||||
|
||||
@@ -38,6 +38,8 @@ rmdir($dir_path);
|
||||
*** Testing closedir() : basic functionality ***
|
||||
|
||||
-- Call closedir() with no arguments: --
|
||||
|
||||
Deprecated: closedir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
NULL
|
||||
-- Check Directory Handle: --
|
||||
resource(%d) of type (Unknown)
|
||||
|
||||
@@ -8,5 +8,6 @@ try {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Deprecated: closedir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
No resource supplied
|
||||
|
||||
@@ -65,6 +65,18 @@ string(9) "file3.tmp"
|
||||
|
||||
-- Call readdir() without $path argument --
|
||||
resource(%d) of type (stream)
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
string(1) "."
|
||||
string(2) ".."
|
||||
string(9) "file1.tmp"
|
||||
|
||||
@@ -59,6 +59,18 @@ string(9) "file3.tmp"
|
||||
|
||||
-- Call readdir() without $path argument --
|
||||
resource(%d) of type (stream)
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
string(1) "."
|
||||
string(2) ".."
|
||||
string(9) "file1.tmp"
|
||||
|
||||
@@ -61,7 +61,7 @@ closedir();
|
||||
$dir_path = __DIR__ . "/私はガラスを食べられますreaddir_variation6";
|
||||
rmdir($dir_path);
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
*** Testing readdir() : usage variations ***
|
||||
|
||||
-- Reading Directory Contents with Previous Handle --
|
||||
@@ -72,8 +72,22 @@ string(59) "私はガラスを食べられますreaddir_variation62.tmp"
|
||||
string(59) "私はガラスを食べられますreaddir_variation63.tmp"
|
||||
|
||||
-- Reading Directory Contents with Current Handle (no arguments supplied) --
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
string(1) "."
|
||||
string(2) ".."
|
||||
string(59) "私はガラスを食べられますreaddir_variation61.tmp"
|
||||
string(59) "私はガラスを食べられますreaddir_variation62.tmp"
|
||||
string(59) "私はガラスを食べられますreaddir_variation63.tmp"
|
||||
|
||||
Deprecated: closedir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
@@ -55,7 +55,7 @@ closedir();
|
||||
$dir_path = __DIR__ . "/readdir_variation6";
|
||||
rmdir($dir_path);
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
*** Testing readdir() : usage variations ***
|
||||
|
||||
-- Reading Directory Contents with Previous Handle --
|
||||
@@ -66,8 +66,22 @@ string(23) "readdir_variation62.tmp"
|
||||
string(23) "readdir_variation63.tmp"
|
||||
|
||||
-- Reading Directory Contents with Current Handle (no arguments supplied) --
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
string(1) "."
|
||||
string(2) ".."
|
||||
string(23) "readdir_variation61.tmp"
|
||||
string(23) "readdir_variation62.tmp"
|
||||
string(23) "readdir_variation63.tmp"
|
||||
|
||||
Deprecated: closedir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
@@ -82,6 +82,14 @@ NULL
|
||||
bool(true)
|
||||
|
||||
-- Read and rewind second directory (no argument supplied) --
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
@@ -90,5 +98,9 @@ array(3) {
|
||||
[2]=>
|
||||
string(45) "私はガラスを食べられますfile2.tmp"
|
||||
}
|
||||
|
||||
Deprecated: rewinddir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
NULL
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
bool(true)
|
||||
|
||||
@@ -76,6 +76,14 @@ NULL
|
||||
bool(true)
|
||||
|
||||
-- Read and rewind second directory (no argument supplied) --
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
array(3) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
@@ -84,5 +92,9 @@ array(3) {
|
||||
[2]=>
|
||||
string(9) "file2.tmp"
|
||||
}
|
||||
|
||||
Deprecated: rewinddir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
NULL
|
||||
|
||||
Deprecated: readdir(): Passing null is deprecated, instead the last opened directory stream should be provided in %s on line %d
|
||||
bool(true)
|
||||
|
||||
Reference in New Issue
Block a user