mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Inlines the behaviour of php_mkdir_ex() into plain wrapper mkdir handler (#15520)
This effectively inlines the behaviour of php_mkdir_ex() which is a deprecated API from at least 17 years ago, and also fixes some of the return values. This also removes a dependency on ext/standard
This commit is contained in:
committed by
GitHub
parent
8a5ada4e10
commit
064ea9c505
@@ -376,6 +376,8 @@ PHP 8.4 INTERNALS UPGRADE NOTES
|
||||
- The deprecated php_uint32 and php_int32 typedefs have been removed from
|
||||
ext/standard/basic_functions.h. Use the standard uint32_t and int32_t
|
||||
types instead.
|
||||
- The php_mkdir() and php_mkdir_ex() APIs have been removed, use
|
||||
php_stream_mkdir() instead.
|
||||
- The php_strtoupper(), php_string_toupper(), php_strtolower(), and
|
||||
php_string_tolower() functions has been removed, use zend_str_toupper(),
|
||||
zend_string_toupper(), zend_str_tolower(), and zend_string_tolower()
|
||||
|
||||
@@ -1109,30 +1109,6 @@ PHPAPI PHP_FUNCTION(fseek)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_mkdir */
|
||||
|
||||
/* DEPRECATED APIs: Use php_stream_mkdir() instead */
|
||||
PHPAPI int php_mkdir_ex(const char *dir, zend_long mode, int options)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (php_check_open_basedir(dir)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((ret = VCWD_MKDIR(dir, (mode_t)mode)) < 0 && (options & REPORT_ERRORS)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
PHPAPI int php_mkdir(const char *dir, zend_long mode)
|
||||
{
|
||||
return php_mkdir_ex(dir, mode, REPORT_ERRORS);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ Create a directory */
|
||||
PHP_FUNCTION(mkdir)
|
||||
{
|
||||
|
||||
@@ -40,8 +40,6 @@ PHPAPI int php_le_stream_context(void);
|
||||
PHPAPI zend_result php_copy_file(const char *src, const char *dest);
|
||||
PHPAPI zend_result php_copy_file_ex(const char *src, const char *dest, int src_flags);
|
||||
PHPAPI zend_result php_copy_file_ctx(const char *src, const char *dest, int src_flags, php_stream_context *ctx);
|
||||
PHPAPI int php_mkdir_ex(const char *dir, zend_long mode, int options);
|
||||
PHPAPI int php_mkdir(const char *dir, zend_long mode);
|
||||
PHPAPI void php_fstat(php_stream *stream, zval *return_value);
|
||||
PHPAPI void php_flock_common(php_stream *stream, zend_long operation, uint32_t operation_arg_num,
|
||||
zval *wouldblock, zval *return_value);
|
||||
|
||||
@@ -1374,7 +1374,17 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i
|
||||
}
|
||||
|
||||
if (!(options & PHP_STREAM_MKDIR_RECURSIVE)) {
|
||||
return php_mkdir(dir, mode) == 0;
|
||||
if (php_check_open_basedir(dir)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ret = VCWD_MKDIR(dir, (mode_t)mode);
|
||||
if (ret < 0 && (options & REPORT_ERRORS)) {
|
||||
php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
char buf[MAXPATHLEN];
|
||||
|
||||
Reference in New Issue
Block a user