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
@@ -278,7 +279,7 @@ PHP_FUNCTION(chroot)
278
279
279
280
ret = chroot (str );
280
281
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 );
282
283
RETURN_FALSE ;
283
284
}
284
285
@@ -287,7 +288,7 @@ PHP_FUNCTION(chroot)
287
288
ret = chdir ("/" );
288
289
289
290
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 );
291
292
RETURN_FALSE ;
292
293
}
293
294
@@ -313,7 +314,7 @@ PHP_FUNCTION(chdir)
313
314
ret = VCWD_CHDIR (str );
314
315
315
316
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 );
317
318
RETURN_FALSE ;
318
319
}
319
320
@@ -415,12 +416,12 @@ PHP_FUNCTION(glob)
415
416
ZEND_PARSE_PARAMETERS_END ();
416
417
417
418
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 );
419
420
RETURN_FALSE ;
420
421
}
421
422
422
423
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" );
424
425
RETURN_FALSE ;
425
426
}
426
427
@@ -558,7 +559,7 @@ PHP_FUNCTION(scandir)
558
559
n = php_stream_scandir (dirn , & namelist , context , (void * ) php_stream_dirent_alphasortr );
559
560
}
560
561
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 ));
562
563
RETURN_FALSE ;
563
564
}
564
565
0 commit comments