Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ini_entries is read-only starting with PHP 8.3 #2559

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

remicollet
Copy link
Contributor

See relevant commit
php/php-src@d53ad4b

Without this change, building against PHP 8.3.0RC1 (which have final API)

plugins/php/php_plugin.c: In function ‘uwsgi_php_append_config’:
plugins/php/php_plugin.c:226:66: warning: passing argument 1 of ‘realloc’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  226 |         uwsgi_sapi_module.ini_entries = realloc(uwsgi_sapi_module.ini_entries, uphp.ini_size + file_size);
      |                                                 ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from /opt/remi/php83/root/usr/include/php/main/../main/php_config.h:2313,
                 from /opt/remi/php83/root/usr/include/php/Zend/zend_config.h:1,
                 from /opt/remi/php83/root/usr/include/php/Zend/zend_portability.h:43,
                 from /opt/remi/php83/root/usr/include/php/Zend/zend_types.h:25,
                 from /opt/remi/php83/root/usr/include/php/Zend/zend.h:27,
                 from /opt/remi/php83/root/usr/include/php/main/php.h:31,
                 from plugins/php/common.h:1,
                 from plugins/php/php_plugin.c:1:
/usr/include/stdlib.h:564:29: note: expected ‘void *’ but argument is of type ‘const char *’
  564 | extern void *realloc (void *__ptr, size_t __size)
      |                       ~~~~~~^~~~~
plugins/php/php_plugin.c:227:46: warning: passing argument 1 of ‘memcpy’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  227 |         memcpy(uwsgi_sapi_module.ini_entries + uphp.ini_size, file_content, file_size);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/features.h:490,
                 from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdlib.h:26:
/usr/include/bits/string_fortified.h:26:1: note: expected ‘void * restrict’ but argument is of type ‘const char *’
   26 | __NTH (memcpy (void *__restrict __dest, const void *__restrict __src,
      | ^~~~~
plugins/php/php_plugin.c: In function ‘uwsgi_php_set’:
plugins/php/php_plugin.c:234:66: warning: passing argument 1 of ‘realloc’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  234 |         uwsgi_sapi_module.ini_entries = realloc(uwsgi_sapi_module.ini_entries, uphp.ini_size + strlen(opt)+2);
      |                                                 ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/usr/include/stdlib.h:564:29: note: expected ‘void *’ but argument is of type ‘const char *’
  564 | extern void *realloc (void *__ptr, size_t __size)
      |                       ~~~~~~^~~~~
plugins/php/php_plugin.c:235:46: warning: passing argument 1 of ‘memcpy’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  235 |         memcpy(uwsgi_sapi_module.ini_entries + uphp.ini_size, opt, strlen(opt));
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/usr/include/bits/string_fortified.h:26:1: note: expected ‘void * restrict’ but argument is of type ‘const char *’
   26 | __NTH (memcpy (void *__restrict __dest, const void *__restrict __src,
      | ^~~~~
plugins/php/php_plugin.c:238:56: error: assignment of read-only location ‘*(uwsgi_sapi_module.ini_entries + ((sizetype)uphp.ini_size + 18446744073709551615))’
  238 |         uwsgi_sapi_module.ini_entries[uphp.ini_size-1] = '\n';
      |                                                        ^
plugins/php/php_plugin.c:239:54: error: assignment of read-only location ‘*(uwsgi_sapi_module.ini_entries + (sizetype)uphp.ini_size)’
  239 |         uwsgi_sapi_module.ini_entries[uphp.ini_size] = 0;
      |                                                      ^
*** unable to build php83 plugin ***

@remicollet remicollet changed the title ini_entries is read-only PHP 8.3 ini_entries is read-only starting with PHP 8.3 Sep 4, 2023
@xrmx xrmx merged commit 9d57149 into unbit:master Oct 3, 2023
23 checks passed
@xrmx
Copy link
Collaborator

xrmx commented Oct 3, 2023

Thanks!

@remicollet remicollet deleted the issue-php83 branch October 3, 2023 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants