diff options
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | php-pecl-seaslog.spec | 13 | ||||
| -rw-r--r-- | seaslog-php81.patch | 129 | 
3 files changed, 141 insertions, 3 deletions
@@ -1,5 +1,7 @@ +clog  package-*.xml  *.tgz +*.tar.bz2  *.tar.gz  *.tar.xz  *.tar.xz.asc diff --git a/php-pecl-seaslog.spec b/php-pecl-seaslog.spec index 21d390c..84159c9 100644 --- a/php-pecl-seaslog.spec +++ b/php-pecl-seaslog.spec @@ -1,6 +1,6 @@  # remirepo spec file for php-pecl-seaslog  # -# Copyright (c) 2015-2023 Remi Collet +# Copyright (c) 2015-2024 Remi Collet  # License: CC-BY-SA-4.0  # http://creativecommons.org/licenses/by-sa/4.0/  # @@ -24,11 +24,14 @@  Summary:        An effective, fast, stable log extension for PHP  Name:           %{?scl_prefix}php-pecl-%{pecl_name}  Version:        2.2.0 -Release:        2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release:        3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}  License:        PHP-3.0.1  URL:            https://pecl.php.net/package/%{proj_name}  Source0:        https://pecl.php.net/get/%{sources}.tgz +# upstream patch + https://github.com/SeasX/SeasLog/pull/322 +Patch0:         %{pecl_name}-php81.patch +  BuildRequires:  make  BuildRequires:  %{?dtsprefix}gcc  BuildRequires:  %{?scl_prefix}php-devel @@ -71,7 +74,7 @@ sed -e 's/role="test"/role="src"/' \      -i package.xml  cd %{sources} -#sed -e 's/ifndef ulong/if 0/' -i include/php7_wrapper.h +%patch -P0 -p1  : Sanity check, really often broken  extver=$(sed -n '/#define SEASLOG_VERSION /{s/.* "//;s/".*$//;p}' include/SeasLog.h) @@ -223,6 +226,10 @@ fi  %changelog +* Mon Feb 19 2024 Remi Collet <remi@remirepo.net> - 2.2.0-3 +- fix for PHP 8.1 using patch from +  https://github.com/SeasX/SeasLog/pull/322 +  * Fri Sep  1 2023 Remi Collet <remi@remirepo.net> - 2.2.0-2  - build out of sources tree diff --git a/seaslog-php81.patch b/seaslog-php81.patch new file mode 100644 index 0000000..e94dd76 --- /dev/null +++ b/seaslog-php81.patch @@ -0,0 +1,129 @@ +From 68a767e4cef28be8293810fd75b8621179aa8226 Mon Sep 17 00:00:00 2001 +From: Carl <631929063@qq.com> +Date: Fri, 23 Jul 2021 21:25:18 +0800 +Subject: [PATCH] Fix seaslog_error_cb error type + +--- + src/ErrorHook.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/ErrorHook.c b/src/ErrorHook.c +index f23874f..9ae19bf 100644 +--- a/src/ErrorHook.c ++++ b/src/ErrorHook.c +@@ -43,7 +43,7 @@ static void process_event_error(const char *event_type, int type, char * error_f + #if PHP_VERSION_ID < 80000 + void seaslog_error_cb(int type, const char *error_filename, const SEASLOG_UINT error_lineno, const char *format, va_list args) + #else +-void seaslog_error_cb(int type, const char *error_filename, const SEASLOG_UINT error_lineno,zend_string *message) ++void seaslog_error_cb(int orig_type, const char *error_filename, const SEASLOG_UINT error_lineno,zend_string *message) + #endif + { +     TSRMLS_FETCH(); +@@ -52,7 +52,7 @@ void seaslog_error_cb(int type, const char *error_filename, const SEASLOG_UINT e + #if PHP_VERSION_ID < 80000 +         return old_error_cb(type, error_filename, error_lineno, format, args); + #else +-        return old_error_cb(type, error_filename, error_lineno, message); ++        return old_error_cb(orig_type, error_filename, error_lineno, message); + #endif +     } +  +@@ -71,6 +71,7 @@ void seaslog_error_cb(int type, const char *error_filename, const SEASLOG_UINT e +         va_end(args_copy); + #else +         char *msg = ZSTR_VAL(message); ++        int type = orig_type & E_ALL; + #endif +         if (type == E_ERROR || type == E_PARSE || type == E_CORE_ERROR || type == E_COMPILE_ERROR || type == E_USER_ERROR || type == E_RECOVERABLE_ERROR) +         { +@@ -100,7 +101,7 @@ void seaslog_error_cb(int type, const char *error_filename, const SEASLOG_UINT e + #if PHP_VERSION_ID < 80000 +     return old_error_cb(type, error_filename, error_lineno, format, args); + #else +-    return old_error_cb(type, error_filename, error_lineno, message); ++    return old_error_cb(orig_type, error_filename, error_lineno, message); + #endif + } +  +From 1677e6dc5d363c4a7d443a312beffa15c31c635e Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Mon, 19 Feb 2024 16:01:36 +0100 +Subject: [PATCH] Fix zend_error_cb usage in PHP >= 8.1 + +--- + src/ErrorHook.c | 28 ++++++++++++++++++++++------ + 1 file changed, 22 insertions(+), 6 deletions(-) + +diff --git a/src/ErrorHook.c b/src/ErrorHook.c +index 9ae19bf..06b35ee 100644 +--- a/src/ErrorHook.c ++++ b/src/ErrorHook.c +@@ -19,11 +19,13 @@ +  + #if PHP_VERSION_ID < 80000 + void (*old_error_cb)(int type, const char *error_filename, const SEASLOG_UINT error_lineno, const char *format, va_list args); +-#else ++#elif PHP_VERSION_ID < 80100 + void (*old_error_cb)(int type, const char *error_filename, const SEASLOG_UINT error_lineno, zend_string *message); ++#else ++void (*old_error_cb)(int type, zend_string *error_filename, const SEASLOG_UINT error_lineno, zend_string *message); + #endif +  +-static void process_event_error(const char *event_type, int type, char * error_filename, SEASLOG_UINT error_lineno, char * msg TSRMLS_DC) ++static void process_event_error(const char *event_type, int type, const char * error_filename, SEASLOG_UINT error_lineno, char * msg TSRMLS_DC) + { +     char *event_str; +     int event_str_len; +@@ -42,8 +44,10 @@ static void process_event_error(const char *event_type, int type, char * error_f +  + #if PHP_VERSION_ID < 80000 + void seaslog_error_cb(int type, const char *error_filename, const SEASLOG_UINT error_lineno, const char *format, va_list args) +-#else ++#elif PHP_VERSION_ID < 80100 + void seaslog_error_cb(int orig_type, const char *error_filename, const SEASLOG_UINT error_lineno,zend_string *message) ++#else ++void seaslog_error_cb(int orig_type, zend_string *error_filename, const SEASLOG_UINT error_lineno,zend_string *message) + #endif + { +     TSRMLS_FETCH(); +@@ -77,21 +81,33 @@ void seaslog_error_cb(int orig_type, const char *error_filename, const SEASLOG_U +         { +             if (SEASLOG_G(trace_error)) +             { +-                process_event_error("Error", type, (char *) error_filename, error_lineno, msg TSRMLS_CC); ++#if PHP_VERSION_ID < 80100 ++                process_event_error("Error", type, error_filename, error_lineno, msg TSRMLS_CC); ++#else ++                process_event_error("Error", type, ZSTR_VAL(error_filename), error_lineno, msg); ++#endif +             } +         } +         else if (type == E_WARNING || type == E_CORE_WARNING || type == E_COMPILE_WARNING || type == E_USER_WARNING) +         { +             if (SEASLOG_G(trace_warning)) +             { +-                process_event_error("Warning", type, (char *) error_filename, error_lineno, msg TSRMLS_CC); ++#if PHP_VERSION_ID < 80100 ++                process_event_error("Warning", type, error_filename, error_lineno, msg TSRMLS_CC); ++#else ++                process_event_error("Warning", type, ZSTR_VAL(error_filename), error_lineno, msg); ++#endif +             } +         } +         else if (type == E_NOTICE || type == E_USER_NOTICE || type == E_STRICT || type == E_DEPRECATED || type == E_USER_DEPRECATED) +         { +             if (SEASLOG_G(trace_notice)) +             { +-                process_event_error("Notice", type, (char *) error_filename, error_lineno, msg TSRMLS_CC); ++#if PHP_VERSION_ID < 80100 ++                process_event_error("Notice", type, error_filename, error_lineno, msg TSRMLS_CC); ++#else ++                process_event_error("Notice", type, ZSTR_VAL(error_filename), error_lineno, msg); ++#endif +             } +         } + #if PHP_VERSION_ID < 80000 +--  +2.43.2 +  | 
