mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Replace uses of php_dirname() with zend_dirname() (#15393)
This removes some needs to include the php_string.h header
This commit is contained in:
committed by
GitHub
parent
2054c3d238
commit
02177848e4
@@ -23,7 +23,7 @@
|
||||
#include "ext/standard/php_filestat.h"
|
||||
#include "ext/standard/flock_compat.h"
|
||||
#include "ext/standard/scanf.h"
|
||||
#include "ext/standard/php_string.h"
|
||||
#include "ext/standard/php_string.h" /* For php_basename() */
|
||||
#include "zend_attributes.h"
|
||||
#include "zend_exceptions.h"
|
||||
#include "zend_interfaces.h"
|
||||
@@ -1362,7 +1362,7 @@ PHP_METHOD(SplFileInfo, getPathInfo)
|
||||
path = spl_filesystem_object_get_pathname(intern);
|
||||
if (path && ZSTR_LEN(path)) {
|
||||
zend_string *dpath = zend_string_init(ZSTR_VAL(path), ZSTR_LEN(path), 0);
|
||||
ZSTR_LEN(dpath) = php_dirname(ZSTR_VAL(dpath), ZSTR_LEN(path));
|
||||
ZSTR_LEN(dpath) = zend_dirname(ZSTR_VAL(dpath), ZSTR_LEN(path));
|
||||
spl_filesystem_object_create_info(dpath, ce, return_value);
|
||||
zend_string_release(dpath);
|
||||
}
|
||||
|
||||
@@ -99,8 +99,9 @@ PHP_FUNCTION(linkinfo)
|
||||
Z_PARAM_PATH(link, link_len)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
// TODO Check for empty string
|
||||
dirname = estrndup(link, link_len);
|
||||
php_dirname(dirname, link_len);
|
||||
zend_dirname(dirname, link_len);
|
||||
|
||||
if (php_check_open_basedir(dirname)) {
|
||||
efree(dirname);
|
||||
@@ -141,7 +142,7 @@ PHP_FUNCTION(symlink)
|
||||
}
|
||||
|
||||
memcpy(dirname, source_p, sizeof(source_p));
|
||||
len = php_dirname(dirname, strlen(dirname));
|
||||
len = zend_dirname(dirname, strlen(dirname));
|
||||
|
||||
if (!expand_filepath_ex(topath, dest_p, dirname, len)) {
|
||||
php_error_docref(NULL, E_WARNING, "No such file or directory");
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_xmlwriter.h"
|
||||
#include "php_xmlwriter_arginfo.h"
|
||||
#include "ext/standard/php_string.h" /* For php_dirname() */
|
||||
|
||||
static zend_class_entry *xmlwriter_class_entry_ce;
|
||||
|
||||
@@ -158,7 +157,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
|
||||
}
|
||||
|
||||
memcpy(file_dirname, source, strlen(source));
|
||||
dir_len = php_dirname(file_dirname, strlen(source));
|
||||
dir_len = zend_dirname(file_dirname, strlen(source));
|
||||
|
||||
if (dir_len > 0) {
|
||||
zend_stat_t buf = {0};
|
||||
|
||||
@@ -171,7 +171,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, const char *file, s
|
||||
is_dir_only = 1;
|
||||
} else {
|
||||
memcpy(file_dirname, path_cleaned, path_cleaned_len);
|
||||
dir_len = php_dirname(file_dirname, path_cleaned_len);
|
||||
dir_len = zend_dirname(file_dirname, path_cleaned_len);
|
||||
|
||||
if (!dir_len || (dir_len == 1 && file_dirname[0] == '.')) {
|
||||
len = spprintf(&file_dirname_fullpath, 0, "%s", dest);
|
||||
|
||||
@@ -95,7 +95,6 @@
|
||||
#include "zend_smart_str.h"
|
||||
#include "ext/standard/html.h"
|
||||
#include "ext/standard/url.h" /* for php_raw_url_decode() */
|
||||
#include "ext/standard/php_string.h" /* for php_dirname() */
|
||||
#include "ext/date/php_date.h" /* for php_format_date() */
|
||||
#include "php_network.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user