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
@@ -280,7 +281,7 @@ PHP_FUNCTION(chroot)
280281
281282 ret = chroot (str );
282283 if (ret != 0 ) {
283- php_error_docref (NULL , E_WARNING , "%s (errno %d)" , strerror (errno ), errno );
284+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "%s (errno %d)" , strerror (errno ), errno );
284285 RETURN_FALSE ;
285286 }
286287
@@ -289,7 +290,7 @@ PHP_FUNCTION(chroot)
289290 ret = chdir ("/" );
290291
291292 if (ret != 0 ) {
292- php_error_docref (NULL , E_WARNING , "%s (errno %d)" , strerror (errno ), errno );
293+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "%s (errno %d)" , strerror (errno ), errno );
293294 RETURN_FALSE ;
294295 }
295296
@@ -315,7 +316,7 @@ PHP_FUNCTION(chdir)
315316 ret = VCWD_CHDIR (str );
316317
317318 if (ret != 0 ) {
318- php_error_docref (NULL , E_WARNING , "%s (errno %d)" , strerror (errno ), errno );
319+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "%s (errno %d)" , strerror (errno ), errno );
319320 RETURN_FALSE ;
320321 }
321322
@@ -417,12 +418,12 @@ PHP_FUNCTION(glob)
417418 ZEND_PARSE_PARAMETERS_END ();
418419
419420 if (pattern_len >= MAXPATHLEN ) {
420- php_error_docref (NULL , E_WARNING , "Pattern exceeds the maximum allowed length of %d characters" , MAXPATHLEN );
421+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "Pattern exceeds the maximum allowed length of %d characters" , MAXPATHLEN );
421422 RETURN_FALSE ;
422423 }
423424
424425 if ((GLOB_AVAILABLE_FLAGS & flags ) != flags ) {
425- php_error_docref (NULL , E_WARNING , "At least one of the passed flags is invalid or not supported on this platform" );
426+ 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" );
426427 RETURN_FALSE ;
427428 }
428429
@@ -560,7 +561,7 @@ PHP_FUNCTION(scandir)
560561 n = php_stream_scandir (dirn , & namelist , context , (void * ) php_stream_dirent_alphasortr );
561562 }
562563 if (n < 0 ) {
563- php_error_docref (NULL , E_WARNING , "(errno %d): %s" , errno , strerror (errno ));
564+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "(errno %d): %s" , errno , strerror (errno ));
564565 RETURN_FALSE ;
565566 }
566567
0 commit comments