summaryrefslogtreecommitdiffstats
path: root/22.patch
diff options
context:
space:
mode:
Diffstat (limited to '22.patch')
-rw-r--r--22.patch238
1 files changed, 238 insertions, 0 deletions
diff --git a/22.patch b/22.patch
new file mode 100644
index 0000000..60d5f62
--- /dev/null
+++ b/22.patch
@@ -0,0 +1,238 @@
+From d3512d945f0f161abe26b4dd87e6cdfbe41cd913 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Thu, 8 Oct 2020 16:43:16 +0200
+Subject: [PATCH 1/3] Fix build woth PHP 8
+
+---
+ src/php_ahocorasick.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/php_ahocorasick.h b/src/php_ahocorasick.h
+index d2d58de..c00cbd5 100644
+--- a/src/php_ahocorasick.h
++++ b/src/php_ahocorasick.h
+@@ -34,6 +34,11 @@
+ #endif
+
+ // Compatibility
++#ifndef TSRMLS_CC
++#define TSRMLS_CC
++#define TSRMLS_DC
++#endif
++
+ #if PHP_MAJOR_VERSION < 7
+ #define PHP7 0
+ typedef long zend_long;
+
+From 94c4653df65c45574770b3530947188b96397b6b Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Thu, 8 Oct 2020 16:44:07 +0200
+Subject: [PATCH 2/3] Generate arginfo from stub
+
+---
+ src/php_ahocorasick.c | 36 ++++-------------------
+ src/php_ahocorasick.stub.php | 38 ++++++++++++++++++++++++
+ src/php_ahocorasick_arginfo.h | 44 ++++++++++++++++++++++++++++
+ src/php_ahocorasick_legacy_arginfo.h | 44 ++++++++++++++++++++++++++++
+ 4 files changed, 132 insertions(+), 30 deletions(-)
+ create mode 100644 src/php_ahocorasick.stub.php
+ create mode 100644 src/php_ahocorasick_arginfo.h
+ create mode 100644 src/php_ahocorasick_legacy_arginfo.h
+
+diff --git a/src/php_ahocorasick.c b/src/php_ahocorasick.c
+index ce0da64..5ceef44 100644
+--- a/src/php_ahocorasick.c
++++ b/src/php_ahocorasick.c
+@@ -66,40 +66,16 @@ 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, 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
+-};
++#if PHP_VERSION_ID < 80000
++#include "php_ahocorasick_legacy_arginfo.h"
++#else
++#include "php_ahocorasick_arginfo.h"
++#endif
+
+ zend_module_entry ahocorasick_module_entry = {
+ STANDARD_MODULE_HEADER,
+ PHP_AHOCORASICK_EXTNAME,
+- ahocorasick_functions,
++ ext_functions,
+ PHP_MINIT(ahocorasick),
+ PHP_MSHUTDOWN(ahocorasick),
+ PHP_RINIT(ahocorasick),
+diff --git a/src/php_ahocorasick.stub.php b/src/php_ahocorasick.stub.php
+new file mode 100644
+index 0000000..1286f4b
+--- /dev/null
++++ b/src/php_ahocorasick.stub.php
+@@ -0,0 +1,38 @@
++<?php
++
++/**
++ * @generate-function-entries
++ * @generate-legacy-arginfo
++ */
++
++
++/**
++ * @param resource $id
++ */
++function ahocorasick_match(string $needle, $id, bool $findAll=true): false|array {}
++
++/**
++ * @return resource
++ */
++function ahocorasick_init(array $data) {}
++
++/**
++ * @param resource $id
++ */
++function ahocorasick_deinit($id):bool {}
++
++/**
++ * @param resource $id
++ */
++function ahocorasick_isValid($id): bool {}
++
++/**
++ * @param resource $id
++ */
++function ahocorasick_finalize($id): bool {}
++
++/**
++ * @param resource $id
++ */
++function ahocorasick_add_patterns($id, array $patterns): bool {}
++
+diff --git a/src/php_ahocorasick_arginfo.h b/src/php_ahocorasick_arginfo.h
+new file mode 100644
+index 0000000..ea731f4
+--- /dev/null
++++ b/src/php_ahocorasick_arginfo.h
+@@ -0,0 +1,44 @@
++/* This is a generated file, edit the .stub.php file instead.
++ * Stub hash: ba403304a9d28e8231b959ba328e0b9ef4ae92c2 */
++
++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ahocorasick_match, 0, 2, MAY_BE_FALSE|MAY_BE_ARRAY)
++ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
++ ZEND_ARG_INFO(0, id)
++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, findAll, _IS_BOOL, 0, "true")
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_ahocorasick_init, 0, 0, 1)
++ ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ahocorasick_deinit, 0, 1, _IS_BOOL, 0)
++ ZEND_ARG_INFO(0, id)
++ZEND_END_ARG_INFO()
++
++#define arginfo_ahocorasick_isValid arginfo_ahocorasick_deinit
++
++#define arginfo_ahocorasick_finalize arginfo_ahocorasick_deinit
++
++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ahocorasick_add_patterns, 0, 2, _IS_BOOL, 0)
++ ZEND_ARG_INFO(0, id)
++ ZEND_ARG_TYPE_INFO(0, patterns, IS_ARRAY, 0)
++ZEND_END_ARG_INFO()
++
++
++ZEND_FUNCTION(ahocorasick_match);
++ZEND_FUNCTION(ahocorasick_init);
++ZEND_FUNCTION(ahocorasick_deinit);
++ZEND_FUNCTION(ahocorasick_isValid);
++ZEND_FUNCTION(ahocorasick_finalize);
++ZEND_FUNCTION(ahocorasick_add_patterns);
++
++
++static const zend_function_entry ext_functions[] = {
++ ZEND_FE(ahocorasick_match, arginfo_ahocorasick_match)
++ ZEND_FE(ahocorasick_init, arginfo_ahocorasick_init)
++ ZEND_FE(ahocorasick_deinit, arginfo_ahocorasick_deinit)
++ ZEND_FE(ahocorasick_isValid, arginfo_ahocorasick_isValid)
++ ZEND_FE(ahocorasick_finalize, arginfo_ahocorasick_finalize)
++ ZEND_FE(ahocorasick_add_patterns, arginfo_ahocorasick_add_patterns)
++ ZEND_FE_END
++};
+diff --git a/src/php_ahocorasick_legacy_arginfo.h b/src/php_ahocorasick_legacy_arginfo.h
+new file mode 100644
+index 0000000..5cd1eb1
+--- /dev/null
++++ b/src/php_ahocorasick_legacy_arginfo.h
+@@ -0,0 +1,44 @@
++/* This is a generated file, edit the .stub.php file instead.
++ * Stub hash: ba403304a9d28e8231b959ba328e0b9ef4ae92c2 */
++
++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_init, 0, 0, 1)
++ ZEND_ARG_INFO(0, data)
++ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_ahocorasick_deinit, 0, 0, 1)
++ ZEND_ARG_INFO(0, id)
++ZEND_END_ARG_INFO()
++
++#define arginfo_ahocorasick_isValid arginfo_ahocorasick_deinit
++
++#define arginfo_ahocorasick_finalize arginfo_ahocorasick_deinit
++
++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()
++
++
++ZEND_FUNCTION(ahocorasick_match);
++ZEND_FUNCTION(ahocorasick_init);
++ZEND_FUNCTION(ahocorasick_deinit);
++ZEND_FUNCTION(ahocorasick_isValid);
++ZEND_FUNCTION(ahocorasick_finalize);
++ZEND_FUNCTION(ahocorasick_add_patterns);
++
++
++static const zend_function_entry ext_functions[] = {
++ ZEND_FE(ahocorasick_match, arginfo_ahocorasick_match)
++ ZEND_FE(ahocorasick_init, arginfo_ahocorasick_init)
++ ZEND_FE(ahocorasick_deinit, arginfo_ahocorasick_deinit)
++ ZEND_FE(ahocorasick_isValid, arginfo_ahocorasick_isValid)
++ ZEND_FE(ahocorasick_finalize, arginfo_ahocorasick_finalize)
++ ZEND_FE(ahocorasick_add_patterns, arginfo_ahocorasick_add_patterns)
++ ZEND_FE_END
++};
+
+