diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 0ae0ed6bf72e1..36096ebdd415e 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -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() diff --git a/ext/standard/file.c b/ext/standard/file.c index 7d0d2703ca587..01f49640e4af6 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -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) { diff --git a/ext/standard/file.h b/ext/standard/file.h index d56934f20d271..3a9cf1435b143 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -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); diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index fb2addb9e6de2..7b0813c3db623 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -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];