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
@@ -278,7 +279,7 @@ PHP_FUNCTION(chroot)
278279
279280 ret = chroot (str );
280281 if (ret != 0 ) {
281- php_error_docref (NULL , E_WARNING , "%s (errno %d)" , strerror (errno ), errno );
282+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "%s (errno %d)" , strerror (errno ), errno );
282283 RETURN_FALSE ;
283284 }
284285
@@ -287,7 +288,7 @@ PHP_FUNCTION(chroot)
287288 ret = chdir ("/" );
288289
289290 if (ret != 0 ) {
290- php_error_docref (NULL , E_WARNING , "%s (errno %d)" , strerror (errno ), errno );
291+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "%s (errno %d)" , strerror (errno ), errno );
291292 RETURN_FALSE ;
292293 }
293294
@@ -313,7 +314,7 @@ PHP_FUNCTION(chdir)
313314 ret = VCWD_CHDIR (str );
314315
315316 if (ret != 0 ) {
316- php_error_docref (NULL , E_WARNING , "%s (errno %d)" , strerror (errno ), errno );
317+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "%s (errno %d)" , strerror (errno ), errno );
317318 RETURN_FALSE ;
318319 }
319320
@@ -415,12 +416,12 @@ PHP_FUNCTION(glob)
415416 ZEND_PARSE_PARAMETERS_END ();
416417
417418 if (pattern_len >= MAXPATHLEN ) {
418- php_error_docref (NULL , E_WARNING , "Pattern exceeds the maximum allowed length of %d characters" , MAXPATHLEN );
419+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "Pattern exceeds the maximum allowed length of %d characters" , MAXPATHLEN );
419420 RETURN_FALSE ;
420421 }
421422
422423 if ((GLOB_AVAILABLE_FLAGS & flags ) != flags ) {
423- php_error_docref (NULL , E_WARNING , "At least one of the passed flags is invalid or not supported on this platform" );
424+ 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" );
424425 RETURN_FALSE ;
425426 }
426427
@@ -558,7 +559,7 @@ PHP_FUNCTION(scandir)
558559 n = php_stream_scandir (dirn , & namelist , context , (void * ) php_stream_dirent_alphasortr );
559560 }
560561 if (n < 0 ) {
561- php_error_docref (NULL , E_WARNING , "(errno %d): %s" , errno , strerror (errno ));
562+ php_exception_or_warning_docref (NULL , zend_ce_filesystem_error , "(errno %d): %s" , errno , strerror (errno ));
562563 RETURN_FALSE ;
563564 }
564565
0 commit comments