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