Skip to content

php83-intl @8.3.1: error: cannot initialize a variable of type 'const char *' with an rvalue of type 'const void *' #13091

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

Closed
BjarneDMat opened this issue Jan 8, 2024 · 3 comments

Comments

@BjarneDMat
Copy link

Description

compiling gives this error :

 :info:build /opt/local/include/php83/php/Zend/zend_operators.h:272:14:
 error: cannot initialize a variable of type 'const char *' with an rvalue
 of type 'const void *'
 :info:build         const char *p = memchr(s, '\0', maxlen);
 :info:build                     ^   ~~~~~~~~~~~~~~~~~~~~~~~
 :info:build 1 error generated.
 :info:build make: *** [intl_convertcpp.lo] Error 1
 :info:build make: *** Waiting for unfinished jobs....
 :info:build make: Leaving directory
 `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83-intl/work/php-8.3.1/ext/intl'

The problem is in /opt/local/include/php83/php/Zend/zend_operators.h -
specifically these new lines in php83 :
(this is a diff -u w/ the php82 version)

@@ -261,6 +264,16 @@
        }
 }

+static zend_always_inline size_t zend_strnlen(const char* s, size_t
maxlen)
+{
+#if defined(HAVE_STRNLEN)
+       return strnlen(s, maxlen);
+#else
+       const char *p = memchr(s, '\0', maxlen);
+       return p ? p-s : maxlen;
+#endif
+}
+
 ZEND_API zend_result ZEND_FASTCALL increment_function(zval *op1);
 ZEND_API zend_result ZEND_FASTCALL decrement_function(zval *op2);

Anything earlier than Mac OS X 10.7, since strnlen made its first appearance in 10.7. hits the #else and triggers the bug

possible workaround : copy the php82 version of zend_operators.h to php83

I tried that; and it did compile; and it does seem to work

PHP Version

php 8.3.1

Operating System

mac OS X 10.16.8 Snow Leopard

@devnexen
Copy link
Member

devnexen commented Jan 8, 2024

The issue had been fixed recently I believe thus you can either try the PHP-8.3 branch or wait the next 8.3.2 release.

@ryandesign
Copy link
Contributor

Ah yes looks like #12999 fixed by a2068ef. I've added a patch for that to MacPorts and it does fix the problem. Bjarne had originally reported this to us at https://trac.macports.org/ticket/69068.

@BjarneDMat
Copy link
Author

duplicate of #12999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants