1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.4' into PHP-8.5

* PHP-8.4:
  Fix compile warnings under GCC 15.2.1 (#21320)
This commit is contained in:
ndossche
2026-03-02 23:12:48 +01:00
12 changed files with 35 additions and 34 deletions

View File

@@ -168,7 +168,7 @@ static zend_always_inline void zend_hash_real_init_mixed_ex(HashTable *ht)
void *data;
uint32_t nSize = ht->nTableSize;
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize));
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize) != 0);
if (UNEXPECTED(GC_FLAGS(ht) & IS_ARRAY_PERSISTENT)) {
data = pemalloc(HT_SIZE_EX(nSize, HT_SIZE_TO_MASK(nSize)), 1);
@@ -350,7 +350,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_packed_to_hash(HashTable *ht)
uint32_t i;
uint32_t nSize = ht->nTableSize;
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize));
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize) != 0);
HT_ASSERT_RC1(ht);
// Alloc before assign to avoid inconsistencies on OOM
@@ -398,7 +398,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_extend(HashTable *ht, uint32_t nSize, bool
if (nSize == 0) return;
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize));
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize) != 0);
if (UNEXPECTED(HT_FLAGS(ht) & HASH_FLAG_UNINITIALIZED)) {
if (nSize > ht->nTableSize) {
@@ -1317,7 +1317,7 @@ static void ZEND_FASTCALL zend_hash_do_resize(HashTable *ht)
uint32_t nSize = ht->nTableSize + ht->nTableSize;
Bucket *old_buckets = ht->arData;
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize));
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize) != 0);
new_data = pemalloc(HT_SIZE_EX(nSize, HT_SIZE_TO_MASK(nSize)), GC_FLAGS(ht) & IS_ARRAY_PERSISTENT);
ht->nTableSize = nSize;

View File

@@ -272,7 +272,7 @@ PHPAPI zend_string *php_escape_shell_cmd(const zend_string *unescaped_cmd)
size_t x, y;
zend_string *cmd;
#ifndef PHP_WIN32
char *p = NULL;
const char *p = NULL;
#endif
ZEND_ASSERT(!zend_str_has_nul_byte(unescaped_cmd) && "Must be a binary safe string");

View File

@@ -1558,7 +1558,7 @@ static php_stream_filter *strfilter_convert_create(const char *filtername, zval
{
php_convert_filter *inst;
char *dot;
const char *dot;
int conv_mode = 0;
if (filterparams != NULL && Z_TYPE_P(filterparams) != IS_ARRAY) {

View File

@@ -259,8 +259,8 @@ static php_stream_filter *user_filter_factory_create(const char *filtername,
len = strlen(filtername);
/* determine the classname/class entry */
if (NULL == (fdat = zend_hash_str_find_ptr(BG(user_filter_map), (char*)filtername, len))) {
char *period;
if (NULL == (fdat = zend_hash_str_find_ptr(BG(user_filter_map), filtername, len))) {
const char *period;
/* Userspace Filters using ambiguous wildcards could cause problems.
i.e.: myfilter.foo.bar will always call into myfilter.foo.*
@@ -272,16 +272,16 @@ static php_stream_filter *user_filter_factory_create(const char *filtername,
/* Search for wildcard matches instead */
memcpy(wildcard, filtername, len + 1); /* copy \0 */
period = wildcard + (period - filtername);
while (period) {
ZEND_ASSERT(period[0] == '.');
period[1] = '*';
period[2] = '\0';
char *new_period = wildcard + (period - filtername);
while (new_period) {
ZEND_ASSERT(new_period[0] == '.');
new_period[1] = '*';
new_period[2] = '\0';
if (NULL != (fdat = zend_hash_str_find_ptr(BG(user_filter_map), wildcard, strlen(wildcard)))) {
period = NULL;
new_period = NULL;
} else {
*period = '\0';
period = strrchr(wildcard, '.');
*new_period = '\0';
new_period = strrchr(wildcard, '.');
}
}
efree(wildcard);
@@ -307,7 +307,7 @@ static php_stream_filter *user_filter_factory_create(const char *filtername,
filter = php_stream_filter_alloc(&userfilter_ops, NULL, 0);
/* filtername */
add_property_string(&obj, "filtername", (char*)filtername);
add_property_string(&obj, "filtername", filtername);
/* and the parameters, if any */
if (filterparams) {

View File

@@ -641,7 +641,7 @@ static int is_port_number(const char *bindpath)
int fcgi_listen(const char *path, int backlog)
{
char *s;
const char *s;
int tcp = 0;
char host[MAXPATHLEN];
short port = 0;

View File

@@ -1058,7 +1058,7 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ
{
zend_string *replace_origin = NULL;
char *docref_buf = NULL, *target = NULL;
char *docref_target = "", *docref_root = "";
const char *docref_target = "", *docref_root = "";
char *p;
const char *space = "";
const char *class_name = "";

View File

@@ -553,7 +553,7 @@ bound:
PHPAPI zend_result php_network_parse_network_address_with_port(const char *addr, size_t addrlen, struct sockaddr *sa, socklen_t *sl)
{
char *colon;
const char *colon;
char *tmp;
zend_result ret = FAILURE;
short port;

View File

@@ -222,7 +222,7 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval
const php_stream_filter_factory *factory = NULL;
php_stream_filter *filter = NULL;
size_t n;
char *period;
const char *period;
n = strlen(filtername);
@@ -234,17 +234,17 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval
wildname = safe_emalloc(1, n, 3);
memcpy(wildname, filtername, n+1);
period = wildname + (period - filtername);
while (period && !filter) {
ZEND_ASSERT(period[0] == '.');
period[1] = '*';
period[2] = '\0';
char *new_period = wildname + (period - filtername);
while (new_period && !filter) {
ZEND_ASSERT(new_period[0] == '.');
new_period[1] = '*';
new_period[2] = '\0';
if (NULL != (factory = zend_hash_str_find_ptr(filter_hash, wildname, strlen(wildname)))) {
filter = factory->create_filter(filtername, filterparams, persistent);
}
*period = '\0';
period = strrchr(wildname, '.');
*new_period = '\0';
new_period = strrchr(wildname, '.');
}
efree(wildname);
}

View File

@@ -615,7 +615,8 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
{
php_stream *stream;
php_stream_temp_data *ts;
char *comma, *semi, *sep;
char *comma;
const char *semi, *sep;
size_t mlen, dlen, plen, vlen, ilen;
zend_off_t newoffs;
zval meta;
@@ -637,7 +638,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
path += 2;
}
if ((comma = memchr(path, ',', dlen)) == NULL) {
if ((comma = (char *) memchr(path, ',', dlen)) == NULL) {
php_stream_wrapper_log_error(wrapper, options, "rfc2397: no comma in URL");
return NULL;
}

View File

@@ -1778,7 +1778,7 @@ not_relative_path:
ptr = pathbuf;
while (ptr && *ptr) {
end = strchr(ptr, DEFAULT_DIR_SEPARATOR);
end = (char *) strchr(ptr, DEFAULT_DIR_SEPARATOR);
if (end != NULL) {
*end = '\0';
end++;

View File

@@ -617,7 +617,7 @@ static inline int parse_unix_address(php_stream_xport_param *xparam, struct sock
static inline char *parse_ip_address_ex(const char *str, size_t str_len, int *portno, int get_err, zend_string **err)
{
char *colon;
const char *colon;
char *host = NULL;
if (memchr(str, '\0', str_len)) {
@@ -628,7 +628,7 @@ static inline char *parse_ip_address_ex(const char *str, size_t str_len, int *po
#ifdef HAVE_IPV6
if (*(str) == '[' && str_len > 1) {
/* IPV6 notation to specify raw address with port (i.e. [fe80::1]:80) */
char *p = memchr(str + 1, ']', str_len - 2);
const char *p = memchr(str + 1, ']', str_len - 2);
if (!p || *(p + 1) != ':') {
if (get_err) {
*err = strpprintf(0, "Failed to parse IPv6 address \"%s\"", str);

View File

@@ -111,7 +111,7 @@ PHPDBG_API int phpdbg_is_addr(const char *str) /* {{{ */
PHPDBG_API int phpdbg_is_class_method(const char *str, size_t len, char **class, char **method) /* {{{ */
{
char *sep = NULL;
const char *sep = NULL;
if (strstr(str, "#") != NULL)
return 0;