[php-src] Issue #13091: php83-intl @8.3.1: error: cannot initialize a variable of type 'const char *' with an rvalue of type 'const void *'
| From: | BjarneDMat | Date: | Mon, 08 Jan 2024 05:32:36 +0000 |
| Subject: | [php-src] Issue #13091: php83-intl @8.3.1: error: cannot initialize a variable of type 'const char *' with an rvalue of type 'const void *' | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246188@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13091
Author: BjarneDMat
### 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