Commit 0155b50984d for php.net
commit 0155b50984d8f32490718d46b43f145b4a90500d
Author: ndossche <7771979+ndossche@users.noreply.github.com>
Date: Mon Mar 9 20:45:07 2026 +0100
phar: Fix const-generic compile warnings
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 2d8ee9c435e..d4b084217b5 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -46,9 +46,8 @@ static zend_class_entry *phar_ce_entry;
static int phar_file_type(const HashTable *mimes, const char *file, char **mime_type) /* {{{ */
{
- char *ext;
phar_mime_type *mime;
- ext = strrchr(file, '.');
+ const char *ext = strrchr(file, '.');
if (!ext) {
*mime_type = "text/plain";
/* no file extension = assume text/plain */
@@ -347,10 +346,9 @@ static void phar_do_404(phar_archive_data *phar, char *fname, size_t fname_len,
/* post-process REQUEST_URI and retrieve the actual request URI. This is for
cases like http://localhost/blah.phar/path/to/file.php/extra/stuff
which calls "blah.phar" file "path/to/file.php" with PATH_INFO "/extra/stuff" */
-static void phar_postprocess_ru_web(const char *fname, size_t fname_len, const char *entry, size_t *entry_len, char **ru, size_t *ru_len) /* {{{ */
+static void phar_postprocess_ru_web(char *fname, size_t fname_len, char *entry, size_t *entry_len, char **ru, size_t *ru_len) /* {{{ */
{
- const char *e = entry + 1;
- char *u = NULL, *u1 = NULL, *saveu = NULL;
+ char *e = entry + 1, *u1 = NULL, *u = NULL, *saveu = NULL;
size_t e_len = *entry_len - 1, u_len = 0;
phar_archive_data *pphar;
diff --git a/ext/phar/tar.c b/ext/phar/tar.c
index 6a3840b3671..0c93de243ad 100644
--- a/ext/phar/tar.c
+++ b/ext/phar/tar.c
@@ -105,7 +105,8 @@ bool phar_is_tar(const char *buf, const char *fname) /* {{{ */
tar_header *header = (tar_header *) buf;
uint32_t checksum = phar_tar_number(header->checksum, sizeof(header->checksum));
bool is_tar;
- char save[sizeof(header->checksum)], *bname;
+ char save[sizeof(header->checksum)];
+ const char *bname;
/* assume that the first filename in a tar won't begin with <?php */
if (!strncmp(buf, "<?php", sizeof("<?php")-1)) {