From 24f91f05ee7f3971c05e4d4a3e2439bb7f871075 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 10 Jun 2021 16:30:56 +0200 Subject: add patch for PHP 8.1 from https://github.com/bukka/phpc/pull/2 https://github.com/bukka/php-fann/pull/43 --- fann-php81.patch | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 fann-php81.patch (limited to 'fann-php81.patch') diff --git a/fann-php81.patch b/fann-php81.patch new file mode 100644 index 0000000..597d019 --- /dev/null +++ b/fann-php81.patch @@ -0,0 +1,69 @@ +From 319b0bd26acde6f5897f96d5a1f3dfed3f4f482c Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 10 Jun 2021 16:17:26 +0200 +Subject: [PATCH] add PHPC_PHP_STAT helper + +--- + phpc.h | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/phpc.h b/phpc.h +index 9206105..fcf1f02 100644 +--- a/phpc/phpc.h ++++ b/phpc/phpc.h +@@ -29,6 +29,8 @@ + #error "Only PHP 5.2+ supported" + #endif + ++#include "ext/standard/php_filestat.h" ++ + /* no operation */ + #define PHPC_NOOP ((void) 0) + +@@ -1595,5 +1597,16 @@ typedef const char phpc_stream_opener_char_t; + php_stream_locate_url_wrapper(_path, (char **) _path_for_open, _options TSRMLS_CC) + #endif + ++#if (PHP_MAJOR_VERSION == 8 && PHP_MINOR_VERSION >= 1) || (PHP_MAJOR_VERSION > 8) ++static zend_always_inline void PHPC_PHP_STAT(const char *filename, size_t filename_length, int type, zval *return_value) ++{ ++ zend_string *str = zend_string_init(filename, filename_length, 0); ++ php_stat(str, type, return_value); ++ zend_string_release(str); ++} ++#else ++#define PHPC_PHP_STAT php_stat ++#endif ++ + #endif /* PHPC_H */ + +From 79111c0b9504d18f4c9b70c2a6b6ed9eadc5047d Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 10 Jun 2021 16:18:23 +0200 +Subject: [PATCH] Use PHPC_PHP_STAT helper + +--- + fann.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/fann.c b/fann.c +index 68dd96b..d0c0d84 100644 +--- a/fann.c ++++ b/fann.c +@@ -1189,13 +1189,13 @@ static char *php_fann_get_path_for_open(char *path, phpc_str_size_t path_len, in + char *path_for_open; + + if (read) { +- php_stat(path, (php_stat_len) path_len, FS_IS_R, &retval TSRMLS_CC); ++ PHPC_PHP_STAT(path, (php_stat_len) path_len, FS_IS_R, &retval TSRMLS_CC); + } else { +- php_stat(path, (php_stat_len) path_len, FS_IS_W, &retval TSRMLS_CC); ++ PHPC_PHP_STAT(path, (php_stat_len) path_len, FS_IS_W, &retval TSRMLS_CC); + if (PHP_FANN_PATH_FORBIDDEN(retval)) { + char *dirname = estrndup(path, path_len); + size_t dirname_len = php_dirname(dirname, (size_t) path_len); +- php_stat(dirname, (php_stat_len) dirname_len, FS_IS_W, &retval TSRMLS_CC); ++ PHPC_PHP_STAT(dirname, (php_stat_len) dirname_len, FS_IS_W, &retval TSRMLS_CC); + efree(dirname); + } + } -- cgit