diff --git a/config.m4 b/config.m4 index ed69e91..36c25b5 100644 --- a/config.m4 +++ b/config.m4 @@ -19,12 +19,29 @@ if test "$PHP_SYNC" != "no"; then ], [ have_shm_open=yes AC_MSG_RESULT([yes]) - ], [ - AC_MSG_ERROR([shm_open() is not available on this platform]) - ]) - PHP_ADD_LIBRARY(rt,,SYNC_SHARED_LIBADD) - PHP_SUBST(SYNC_SHARED_LIBADD) + PHP_ADD_LIBRARY(rt,,SYNC_SHARED_LIBADD) + PHP_SUBST(SYNC_SHARED_LIBADD) + ], [ + AC_MSG_RESULT([no (attempting fallback)]) + + dnl # Fallback attempt to link without -lrt. + AC_MSG_CHECKING([for shm_open in -pthread]) + + LIBS="$SAVED_LIBS -pthread" + + AC_TRY_LINK([ + #include + #include + ], [ + int fp = shm_open("", O_RDWR | O_CREAT | O_EXCL, 0666); + ], [ + have_shm_open=yes + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_ERROR([shm_open() is not available on this platform]) + ]) + ]) dnl # Finish defining the basic extension support. AC_DEFINE(HAVE_SYNC, 1, [Whether you have synchronization object support]) diff --git a/package.xml b/package.xml index 4b46444..be85702 100644 --- a/package.xml +++ b/package.xml @@ -10,10 +10,10 @@ cubic@php.net yes - 2021-04-09 + 2023-06-28 - 1.1.2 + 1.1.3 1.1.0 @@ -22,7 +22,8 @@ MIT License -- Fixed missing macros for PHP 8 (thanks Remi). +- Fixed Mac OSX support. +- Fixed PHP 8.2 nullability issues. diff --git a/php_sync.h b/php_sync.h index 7abf8e8..8b0caac 100644 --- a/php_sync.h +++ b/php_sync.h @@ -12,7 +12,7 @@ extern zend_module_entry sync_module_entry; #define phpext_sync_ptr &sync_module_entry -#define PHP_SYNC_VERSION "1.1.2" +#define PHP_SYNC_VERSION "1.1.3" #ifdef PHP_WIN32 # define PHP_SYNC_API __declspec(dllexport) diff --git a/sync.c b/sync.c index 6d35f8a..f235088 100644 --- a/sync.c +++ b/sync.c @@ -885,7 +885,7 @@ PHP_METHOD(sync_Mutex, __construct) size_t Pos, TempSize; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) return; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &name, &name_len) == FAILURE) return; obj = (sync_Mutex_object *)PORTABLE_zend_object_store_get_object(); @@ -1126,7 +1126,7 @@ PHP_METHOD(sync_Semaphore, __construct) size_t Pos, TempSize; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sll", &name, &name_len, &initialval, &autounlock) == FAILURE) return; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!ll", &name, &name_len, &initialval, &autounlock) == FAILURE) return; obj = (sync_Semaphore_object *)PORTABLE_zend_object_store_get_object(); @@ -1342,7 +1342,7 @@ PHP_METHOD(sync_Event, __construct) size_t Pos, TempSize; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sll", &name, &name_len, &manual, &prefire) == FAILURE) return; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!ll", &name, &name_len, &manual, &prefire) == FAILURE) return; obj = (sync_Event_object *)PORTABLE_zend_object_store_get_object(); @@ -1675,7 +1675,7 @@ PHP_METHOD(sync_ReaderWriter, __construct) size_t Pos, TempSize; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sl", &name, &name_len, &autounlock) == FAILURE) return; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!l", &name, &name_len, &autounlock) == FAILURE) return; obj = (sync_ReaderWriter_object *)PORTABLE_zend_object_store_get_object();