2323#include "php_string.h"
2424#include "php_scandir.h"
2525#include "basic_functions.h"
26+ #include "io_exceptions.h"
2627#include "dir_arginfo.h"
2728
2829#if HAVE_UNISTD_H
@@ -282,7 +283,7 @@ PHP_FUNCTION(chroot)
282283
283284 ret = chroot (str );
284285 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 );
286287 RETURN_FALSE ;
287288 }
288289
@@ -291,7 +292,7 @@ PHP_FUNCTION(chroot)
291292 ret = chdir ("/" );
292293
293294 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 );
295296 RETURN_FALSE ;
296297 }
297298
@@ -317,7 +318,7 @@ PHP_FUNCTION(chdir)
317318 ret = VCWD_CHDIR (str );
318319
319320 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 );
321322 RETURN_FALSE ;
322323 }
323324
@@ -420,12 +421,12 @@ PHP_FUNCTION(glob)
420421 ZEND_PARSE_PARAMETERS_END ();
421422
422423 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 );
424425 RETURN_FALSE ;
425426 }
426427
427428 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" );
429430 RETURN_FALSE ;
430431 }
431432
@@ -564,7 +565,7 @@ PHP_FUNCTION(scandir)
564565 n = php_stream_scandir (dirn , & namelist , context , (void * ) php_stream_dirent_alphasortr );
565566 }
566567 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 ));
568569 RETURN_FALSE ;
569570 }
570571
0 commit comments