23
23
#include "php_string.h"
24
24
#include "php_scandir.h"
25
25
#include "basic_functions.h"
26
+ #include "io_exceptions.h"
26
27
#include "dir_arginfo.h"
27
28
28
29
#if HAVE_UNISTD_H
@@ -282,7 +283,7 @@ PHP_FUNCTION(chroot)
282
283
283
284
ret = chroot (str );
284
285
if (ret != 0 ) {
285
- php_error_docref (NULL , E_WARNING , "%s (errno %d)" , strerror (errno ), errno );
286
+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "%s (errno %d)" , strerror (errno ), errno );
286
287
RETURN_FALSE ;
287
288
}
288
289
@@ -291,7 +292,7 @@ PHP_FUNCTION(chroot)
291
292
ret = chdir ("/" );
292
293
293
294
if (ret != 0 ) {
294
- php_error_docref (NULL , E_WARNING , "%s (errno %d)" , strerror (errno ), errno );
295
+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "%s (errno %d)" , strerror (errno ), errno );
295
296
RETURN_FALSE ;
296
297
}
297
298
@@ -317,7 +318,7 @@ PHP_FUNCTION(chdir)
317
318
ret = VCWD_CHDIR (str );
318
319
319
320
if (ret != 0 ) {
320
- php_error_docref (NULL , E_WARNING , "%s (errno %d)" , strerror (errno ), errno );
321
+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "%s (errno %d)" , strerror (errno ), errno );
321
322
RETURN_FALSE ;
322
323
}
323
324
@@ -420,12 +421,12 @@ PHP_FUNCTION(glob)
420
421
ZEND_PARSE_PARAMETERS_END ();
421
422
422
423
if (pattern_len >= MAXPATHLEN ) {
423
- php_error_docref (NULL , E_WARNING , "Pattern exceeds the maximum allowed length of %d characters" , MAXPATHLEN );
424
+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "Pattern exceeds the maximum allowed length of %d characters" , MAXPATHLEN );
424
425
RETURN_FALSE ;
425
426
}
426
427
427
428
if ((GLOB_AVAILABLE_FLAGS & flags ) != flags ) {
428
- php_error_docref (NULL , E_WARNING , "At least one of the passed flags is invalid or not supported on this platform" );
429
+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "At least one of the passed flags is invalid or not supported on this platform" );
429
430
RETURN_FALSE ;
430
431
}
431
432
@@ -564,7 +565,7 @@ PHP_FUNCTION(scandir)
564
565
n = php_stream_scandir (dirn , & namelist , context , (void * ) php_stream_dirent_alphasortr );
565
566
}
566
567
if (n < 0 ) {
567
- php_error_docref (NULL , E_WARNING , "(errno %d): %s" , errno , strerror (errno ));
568
+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "(errno %d): %s" , errno , strerror (errno ));
568
569
RETURN_FALSE ;
569
570
}
570
571
0 commit comments