Skip to content

Commit bfd66bb

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: Fix compile warnings under GCC 15.2.1 (#21320) Updated to version 2026.1 (2026a)
2 parents 832a5ea + 2107042 commit bfd66bb

File tree

12 files changed

+33
-32
lines changed

12 files changed

+33
-32
lines changed

Zend/zend_hash.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static zend_always_inline void zend_hash_real_init_mixed_ex(HashTable *ht)
168168
void *data;
169169
uint32_t nSize = ht->nTableSize;
170170

171-
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize));
171+
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize) != 0);
172172

173173
if (UNEXPECTED(GC_FLAGS(ht) & IS_ARRAY_PERSISTENT)) {
174174
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)
350350
uint32_t i;
351351
uint32_t nSize = ht->nTableSize;
352352

353-
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize));
353+
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize) != 0);
354354

355355
HT_ASSERT_RC1(ht);
356356
// 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
398398

399399
if (nSize == 0) return;
400400

401-
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize));
401+
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize) != 0);
402402

403403
if (UNEXPECTED(HT_FLAGS(ht) & HASH_FLAG_UNINITIALIZED)) {
404404
if (nSize > ht->nTableSize) {
@@ -1324,7 +1324,7 @@ static void ZEND_FASTCALL zend_hash_do_resize(HashTable *ht)
13241324
uint32_t nSize = ht->nTableSize + ht->nTableSize;
13251325
Bucket *old_buckets = ht->arData;
13261326

1327-
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize));
1327+
ZEND_ASSERT(HT_SIZE_TO_MASK(nSize) != 0);
13281328

13291329
new_data = pemalloc(HT_SIZE_EX(nSize, HT_SIZE_TO_MASK(nSize)), GC_FLAGS(ht) & IS_ARRAY_PERSISTENT);
13301330
ht->nTableSize = nSize;

ext/standard/exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ PHPAPI zend_string *php_escape_shell_cmd(const zend_string *unescaped_cmd)
272272
size_t x, y;
273273
zend_string *cmd;
274274
#ifndef PHP_WIN32
275-
char *p = NULL;
275+
const char *p = NULL;
276276
#endif
277277

278278
ZEND_ASSERT(!zend_str_has_nul_byte(unescaped_cmd) && "Must be a binary safe string");

ext/standard/filters.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@ static php_stream_filter *strfilter_convert_create(const char *filtername, zval
15581558
{
15591559
php_convert_filter *inst;
15601560

1561-
char *dot;
1561+
const char *dot;
15621562
int conv_mode = 0;
15631563

15641564
if (filterparams != NULL && Z_TYPE_P(filterparams) != IS_ARRAY) {

ext/standard/user_filters.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ static php_stream_filter *user_filter_factory_create(const char *filtername,
260260

261261
/* determine the classname/class entry */
262262
if (NULL == (fdat = zend_hash_str_find_ptr(BG(user_filter_map), filtername, len))) {
263-
char *period;
263+
const char *period;
264264

265265
/* Userspace Filters using ambiguous wildcards could cause problems.
266266
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,
272272

273273
/* Search for wildcard matches instead */
274274
memcpy(wildcard, filtername, len + 1); /* copy \0 */
275-
period = wildcard + (period - filtername);
276-
while (period) {
277-
ZEND_ASSERT(period[0] == '.');
278-
period[1] = '*';
279-
period[2] = '\0';
275+
char *new_period = wildcard + (period - filtername);
276+
while (new_period) {
277+
ZEND_ASSERT(new_period[0] == '.');
278+
new_period[1] = '*';
279+
new_period[2] = '\0';
280280
if (NULL != (fdat = zend_hash_str_find_ptr(BG(user_filter_map), wildcard, strlen(wildcard)))) {
281-
period = NULL;
281+
new_period = NULL;
282282
} else {
283-
*period = '\0';
284-
period = strrchr(wildcard, '.');
283+
*new_period = '\0';
284+
new_period = strrchr(wildcard, '.');
285285
}
286286
}
287287
efree(wildcard);

main/fastcgi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ static int is_port_number(const char *bindpath)
641641

642642
int fcgi_listen(const char *path, int backlog)
643643
{
644-
char *s;
644+
const char *s;
645645
int tcp = 0;
646646
char host[MAXPATHLEN];
647647
short port = 0;

main/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ
10621062
{
10631063
zend_string *replace_origin = NULL;
10641064
char *docref_buf = NULL, *target = NULL;
1065-
char *docref_target = "", *docref_root = "";
1065+
const char *docref_target = "", *docref_root = "";
10661066
char *p;
10671067
const char *space = "";
10681068
const char *class_name = "";

main/network.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsigned po
599599

600600
PHPAPI zend_result php_network_parse_network_address_with_port(const char *addr, size_t addrlen, struct sockaddr *sa, socklen_t *sl)
601601
{
602-
char *colon;
602+
const char *colon;
603603
char *tmp;
604604
zend_result ret = FAILURE;
605605
short port;

main/streams/filter.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval
222222
const php_stream_filter_factory *factory = NULL;
223223
php_stream_filter *filter = NULL;
224224
size_t n;
225-
char *period;
225+
const char *period;
226226

227227
n = strlen(filtername);
228228

@@ -234,17 +234,17 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval
234234

235235
wildname = safe_emalloc(1, n, 3);
236236
memcpy(wildname, filtername, n+1);
237-
period = wildname + (period - filtername);
238-
while (period && !filter) {
239-
ZEND_ASSERT(period[0] == '.');
240-
period[1] = '*';
241-
period[2] = '\0';
237+
char *new_period = wildname + (period - filtername);
238+
while (new_period && !filter) {
239+
ZEND_ASSERT(new_period[0] == '.');
240+
new_period[1] = '*';
241+
new_period[2] = '\0';
242242
if (NULL != (factory = zend_hash_str_find_ptr(filter_hash, wildname, strlen(wildname)))) {
243243
filter = factory->create_filter(filtername, filterparams, persistent);
244244
}
245245

246-
*period = '\0';
247-
period = strrchr(wildname, '.');
246+
*new_period = '\0';
247+
new_period = strrchr(wildname, '.');
248248
}
249249
efree(wildname);
250250
}

main/streams/memory.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,8 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
617617
{
618618
php_stream *stream;
619619
php_stream_temp_data *ts;
620-
char *comma, *semi, *sep;
620+
char *comma;
621+
const char *semi, *sep;
621622
size_t mlen, dlen, plen, vlen, ilen;
622623
zend_off_t newoffs;
623624
zval meta;
@@ -639,7 +640,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con
639640
path += 2;
640641
}
641642

642-
if ((comma = memchr(path, ',', dlen)) == NULL) {
643+
if ((comma = (char *) memchr(path, ',', dlen)) == NULL) {
643644
php_stream_wrapper_log_error(wrapper, options, "rfc2397: no comma in URL");
644645
return NULL;
645646
}

main/streams/plain_wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char
17781778
ptr = pathbuf;
17791779

17801780
while (ptr && *ptr) {
1781-
end = strchr(ptr, DEFAULT_DIR_SEPARATOR);
1781+
end = (char *) strchr(ptr, DEFAULT_DIR_SEPARATOR);
17821782
if (end != NULL) {
17831783
*end = '\0';
17841784
end++;

0 commit comments

Comments
 (0)