#69068 closed defect (fixed)

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

Reported by: BjarneDMat Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: tiger leopard snowleopard Cc:
Port: php83-intl

Description

#=> system_profiler -detaillevel mini SPHardwareDataType SPSoftwareDataType
Hardware:
    Hardware Overview:
      Model Name: Mac mini
      Model Identifier: Macmini2,1
      Processor Name: Intel Core 2 Duo
      Processor Speed: 2 GHz
      Number Of Processors: 1
      Total Number Of Cores: 2
      L2 Cache: 4 MB
      Memory: 4 GB
      Bus Speed: 667 MHz
      Boot ROM Version: MM21.009A.B00
      SMC Version (system): 1.19f2
Software:
    System Software Overview:
      System Version: Mac OS X 10.6.8 (10K549)
      Kernel Version: Darwin 10.8.0
      64-bit Kernel and Extensions: No

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);

It looks af if !only! 10.6.8 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; but I haven't done any checks

Note :
I DO have :

#=> cat com.apple.Boot.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Kernel Flags</key>
	<string>arch=x86_64</string>
</dict>
</plist>

Change History (3)

comment:1 in reply to:  description Changed 11 months ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign removed
Keywords: tiger leopard snowleopard added
Owner: set to ryandesign
Status: newaccepted
Summary: php83-intl fails to compile on 10.6.8php83-intl @8.3.1: error: cannot initialize a variable of type 'const char *' with an rvalue of type 'const void *'

Replying to BjarneDMat:

It looks af if !only! 10.6.8 hits the #else and triggers the bug

Anything earlier than Mac OS X 10.7, since strnlen made its first appearance in 10.7.

This would be a bug to report to the developers of php so they can fix it.

comment:3 Changed 11 months ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

In b054fd917070aba4e2051d9b0e7e48c10dbd9846/macports-ports (master):

php83: Fix zend_strnlen on 10.6 and earlier

Closes: #69068

Note: See TracTickets for help on using tickets.