summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--17.patch52
-rw-r--r--18.patch53
-rw-r--r--5687f6975d8c18223f114d0d0f1246c505b6f101.patch25
-rw-r--r--PHPINFO2
-rw-r--r--REFLECTION29
-rw-r--r--php-pecl-ahocorasick.spec30
6 files changed, 183 insertions, 8 deletions
diff --git a/17.patch b/17.patch
new file mode 100644
index 0000000..e1a769f
--- /dev/null
+++ b/17.patch
@@ -0,0 +1,52 @@
+From c14164b2789c6b01212243a152035db9a5452688 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 15 Mar 2019 08:29:32 +0100
+Subject: [PATCH] fix reported version in phpinfo / reflection
+
+---
+ src/php_ahocorasick.c | 6 +-----
+ src/php_ahocorasick.h | 2 +-
+ 2 files changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/src/php_ahocorasick.c b/src/php_ahocorasick.c
+index 5387fef..0ba9c48 100644
+--- a/src/php_ahocorasick.c
++++ b/src/php_ahocorasick.c
+@@ -63,13 +63,11 @@ static zend_function_entry ahocorasick_functions[] = {
+ PHP_FE(ahocorasick_isValid, NULL)
+ PHP_FE(ahocorasick_finalize, NULL)
+ PHP_FE(ahocorasick_add_patterns, NULL)
+- {NULL, NULL, NULL}
++ PHP_FE_END
+ };
+
+ zend_module_entry ahocorasick_module_entry = {
+-#if ZEND_MODULE_API_NO >= 20010901
+ STANDARD_MODULE_HEADER,
+-#endif
+ PHP_AHOCORASICK_EXTNAME,
+ ahocorasick_functions,
+ PHP_MINIT(ahocorasick),
+@@ -77,9 +75,7 @@ zend_module_entry ahocorasick_module_entry = {
+ PHP_RINIT(ahocorasick),
+ NULL,
+ NULL,
+-#if ZEND_MODULE_API_NO >= 20010901
+ PHP_AHOCORASICK_VERSION,
+-#endif
+ STANDARD_MODULE_PROPERTIES
+ };
+
+diff --git a/src/php_ahocorasick.h b/src/php_ahocorasick.h
+index cab825c..99301ff 100644
+--- a/src/php_ahocorasick.h
++++ b/src/php_ahocorasick.h
+@@ -122,7 +122,7 @@ ZEND_END_MODULE_GLOBALS(ahocorasick)
+ #define AHOCORASICK_G(v) (ahocorasick_globals.v)
+ #endif
+
+-#define PHP_AHOCORASICK_VERSION "2.0"
++#define PHP_AHOCORASICK_VERSION "0.0.4"
+ #define PHP_AHOCORASICK_EXTNAME "ahocorasick"
+
+ /**
diff --git a/18.patch b/18.patch
new file mode 100644
index 0000000..59e3d97
--- /dev/null
+++ b/18.patch
@@ -0,0 +1,53 @@
+From b70b6a92c72e053c9ad6ffe25a3e73849ff46379 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 15 Mar 2019 08:45:22 +0100
+Subject: [PATCH] add arginfo to all functions for reflection
+
+---
+ src/php_ahocorasick.c | 32 ++++++++++++++++++++++++++------
+ 1 file changed, 26 insertions(+), 6 deletions(-)
+
+diff --git a/src/php_ahocorasick.c b/src/php_ahocorasick.c
+index 0ba9c48..f825c4b 100644
+--- a/src/php_ahocorasick.c
++++ b/src/php_ahocorasick.c
+@@ -56,13 +56,33 @@ static char exception_buffer[8192];
+
+ ZEND_DECLARE_MODULE_GLOBALS(ahocorasick)
+
++ZEND_BEGIN_ARG_INFO_EX(arginfo_ahocorasick_match, 0, 0, 2)
++ ZEND_ARG_INFO(0, needle)
++ ZEND_ARG_INFO(0, id)
++ ZEND_ARG_INFO(0, findAll)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_ahocorasick_id, 0, 0, 1)
++ ZEND_ARG_INFO(0, id)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_ahocorasick_init, 0, 0, 1)
++ ZEND_ARG_INFO(0, data)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_ahocorasick_add_patterns, 0, 0, 2)
++ ZEND_ARG_INFO(0, id)
++ ZEND_ARG_INFO(0, patterns)
++ZEND_END_ARG_INFO()
++
++
+ static zend_function_entry ahocorasick_functions[] = {
+- PHP_FE(ahocorasick_match, NULL)
+- PHP_FE(ahocorasick_init, NULL)
+- PHP_FE(ahocorasick_deinit, NULL)
+- PHP_FE(ahocorasick_isValid, NULL)
+- PHP_FE(ahocorasick_finalize, NULL)
+- PHP_FE(ahocorasick_add_patterns, NULL)
++ PHP_FE(ahocorasick_match, arginfo_ahocorasick_match)
++ PHP_FE(ahocorasick_init, arginfo_ahocorasick_init)
++ PHP_FE(ahocorasick_deinit, arginfo_ahocorasick_id)
++ PHP_FE(ahocorasick_isValid, arginfo_ahocorasick_id)
++ PHP_FE(ahocorasick_finalize, arginfo_ahocorasick_id)
++ PHP_FE(ahocorasick_add_patterns, arginfo_ahocorasick_add_patterns)
+ PHP_FE_END
+ };
+
diff --git a/5687f6975d8c18223f114d0d0f1246c505b6f101.patch b/5687f6975d8c18223f114d0d0f1246c505b6f101.patch
new file mode 100644
index 0000000..d8276cf
--- /dev/null
+++ b/5687f6975d8c18223f114d0d0f1246c505b6f101.patch
@@ -0,0 +1,25 @@
+From 5687f6975d8c18223f114d0d0f1246c505b6f101 Mon Sep 17 00:00:00 2001
+From: Dusan Klinec <dusan.klinec@gmail.com>
+Date: Fri, 15 Mar 2019 08:55:50 +0100
+Subject: [PATCH] zstr fix
+
+---
+ src/php_ahocorasick.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/php_ahocorasick.c b/src/php_ahocorasick.c
+index f825c4b..950d3b5 100644
+--- a/src/php_ahocorasick.c
++++ b/src/php_ahocorasick.c
+@@ -254,9 +254,9 @@ static inline int php_ahocorasick_process_pattern(zend_long pidx, ahocorasick_pa
+ keyFound|=0x10;
+ } else {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,
+- "Invalid structure (unrecognized sub-array key: [%s])! "
++ "Invalid structure (unrecognized sub-array key)! "
+ "Only allowed are: {key, id, value, aux, ignoreCase}. Cannot initialize. "
+- "Pattern index: %ld", key, (long)pidx);
++ "Pattern index: %ld", (long)pidx);
+ returnCode = -2;
+ break;
+ }
diff --git a/PHPINFO b/PHPINFO
index d7c3787..9e07551 100644
--- a/PHPINFO
+++ b/PHPINFO
@@ -1,4 +1,4 @@
ahocorasick
-Version => 2.0
+Version => 0.0.4
diff --git a/REFLECTION b/REFLECTION
index 862c7ed..9883167 100644
--- a/REFLECTION
+++ b/REFLECTION
@@ -1,17 +1,44 @@
-Extension [ <persistent> extension #73 ahocorasick version 2.0 ] {
+Extension [ <persistent> extension #73 ahocorasick version 0.0.4 ] {
- Functions {
Function [ <internal:ahocorasick> function ahocorasick_match ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> $needle ]
+ Parameter #1 [ <required> $id ]
+ Parameter #2 [ <optional> $findAll ]
+ }
}
Function [ <internal:ahocorasick> function ahocorasick_init ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $data ]
+ }
}
Function [ <internal:ahocorasick> function ahocorasick_deinit ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $id ]
+ }
}
Function [ <internal:ahocorasick> function ahocorasick_isValid ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $id ]
+ }
}
Function [ <internal:ahocorasick> function ahocorasick_finalize ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $id ]
+ }
}
Function [ <internal:ahocorasick> function ahocorasick_add_patterns ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> $id ]
+ Parameter #1 [ <required> $patterns ]
+ }
}
}
diff --git a/php-pecl-ahocorasick.spec b/php-pecl-ahocorasick.spec
index 035aab8..ec1e7ee 100644
--- a/php-pecl-ahocorasick.spec
+++ b/php-pecl-ahocorasick.spec
@@ -19,17 +19,19 @@
%global ini_name 40-%{pecl_name}.ini
%endif
# Nothing yet
-%global with_tests 0%{?_with_tests:1}
+%global with_tests 0%{!?_without_tests:1}
Summary: Effective Aho-Corasick string pattern matching algorithm
Name: %{?sub_prefix}php-pecl-%{pecl_name}
-Version: 0.0.3
+Version: 0.0.4
Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
License: PHP and LGPLv3
URL: http://pecl.php.net/package/%{pecl_name}
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
-Patch0: https://github.com/ph4r05/php_aho_corasick/pull/11.patch
+Patch0: https://github.com/ph4r05/php_aho_corasick/pull/17.patch
+Patch1: https://github.com/ph4r05/php_aho_corasick/pull/18.patch
+Patch2: https://github.com/ph4r05/php_aho_corasick/commit/5687f6975d8c18223f114d0d0f1246c505b6f101.patch
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel
@@ -96,14 +98,15 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
-%patch0 -p1 -b .pr11
+%patch0 -p1 -b .pr17
+%patch1 -p1 -b .pr18
+%patch2 -p1 -b .up
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_AHOCORASICK_VERSION/{s/.* "//;s/".*$//;p}' src/php_ahocorasick.h)
if test "x${extver}" != "x%{version}"; then
: Error: Upstream extension version is ${extver}, expecting %{version}.
- # TODO check this with upstream
- #exit 1
+ exit 1
fi
cd ..
@@ -183,6 +186,12 @@ fi
%check
+%if "%{php_version}" > "7.3"
+# See https://github.com/ph4r05/php_aho_corasick/pull/16
+rm ?TS/tests/test1.phpt
+rm ?TS/tests/test3.phpt
+%endif
+
cd NTS
: Minimal load test for NTS extension
%{__php} --no-php-ini \
@@ -231,6 +240,15 @@ REPORT_EXIT_STATUS=1 \
%changelog
+* Fri Mar 15 2019 Remi Collet <remi@remirepo.net> - 0.0.4-1
+- update to 0.0.4
+- drop patch merged upstream
+- open https://github.com/ph4r05/php_aho_corasick/pull/17 fix version
+- open https://github.com/ph4r05/php_aho_corasick/pull/16 travis
+- run upstream test suite added in
+ https://github.com/ph4r05/php_aho_corasick/pull/13
+- open https://github.com/ph4r05/php_aho_corasick/pull/18 arginfo
+
* Thu Mar 14 2019 Remi Collet <remi@remirepo.net> - 0.0.3-1
- update to 0.0.3
- open https://github.com/ph4r05/php_aho_corasick/pull/11