Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,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.

h. ext/session
- Added the php_get_session_status() API to get the session status, which is
Expand Down
24 changes: 0 additions & 24 deletions ext/standard/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ PHPAPI int php_set_sock_blocking(php_socket_t socketd, int block);
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);
Expand Down
12 changes: 11 additions & 1 deletion main/streams/plain_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down