summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--37.patch51
-rw-r--r--php-pecl-lua.spec18
2 files changed, 61 insertions, 8 deletions
diff --git a/37.patch b/37.patch
new file mode 100644
index 0000000..d46284b
--- /dev/null
+++ b/37.patch
@@ -0,0 +1,51 @@
+From eff65944b5ec420c0584d5209312f5a5be1a1bb2 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 26 Jun 2018 12:27:09 +0200
+Subject: [PATCH] Fix for PHP 7.3 - Array/Object recursion protection
+
+---
+ lua.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/lua.c b/lua.c
+index 310bf8f..22bc589 100755
+--- a/lua.c
++++ b/lua.c
+@@ -430,6 +430,7 @@ int php_lua_send_zval_to_lua(lua_State *L, zval *val) /* {{{ */ {
+ zval zkey;
+
+ HashTable *ht = HASH_OF(val);
++#if PHP_VERSION_ID < 70300
+ if (ZEND_HASH_APPLY_PROTECTION(ht)) {
+ ZEND_HASH_INC_APPLY_COUNT(ht);
+ if (ZEND_HASH_GET_APPLY_COUNT(ht) > 1) {
+@@ -437,6 +438,15 @@ int php_lua_send_zval_to_lua(lua_State *L, zval *val) /* {{{ */ {
+ ZEND_HASH_DEC_APPLY_COUNT(ht);
+ break;
+ }
++#else
++ if (!(GC_FLAGS(ht) & GC_IMMUTABLE)) {
++ if (GC_IS_RECURSIVE(ht)) {
++ php_error_docref(NULL, E_ERROR, "recursion found");
++ break;
++ } else {
++ GC_PROTECT_RECURSION(ht);
++ }
++#endif
+ }
+
+ lua_newtable(L);
+@@ -452,8 +462,13 @@ int php_lua_send_zval_to_lua(lua_State *L, zval *val) /* {{{ */ {
+ lua_settable(L, -3);
+ } ZEND_HASH_FOREACH_END();
+
++#if PHP_VERSION_ID < 70300
+ if (ZEND_HASH_APPLY_PROTECTION(ht)) {
+ ZEND_HASH_DEC_APPLY_COUNT(ht);
++#else
++ if (!(GC_FLAGS(ht) & GC_IMMUTABLE)) {
++ GC_UNPROTECT_RECURSION(ht);
++#endif
+ }
+ }
+ }
diff --git a/php-pecl-lua.spec b/php-pecl-lua.spec
index eecdaa1..5a849b9 100644
--- a/php-pecl-lua.spec
+++ b/php-pecl-lua.spec
@@ -19,12 +19,15 @@
Summary: Embedded lua interpreter
Name: %{?sub_prefix}php-pecl-%{pecl_name}
Version: 2.0.5
-Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
License: PHP
Group: Development/Languages
URL: http://pecl.php.net/package/%{pecl_name}
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+Patch0: https://patch-diff.githubusercontent.com/raw/laruence/php-lua/pull/37.patch
+
+BuildRequires: %{?dtsprefix}gcc
BuildRequires: lua-devel
BuildRequires: %{?scl_prefix}php-devel > 7
BuildRequires: %{?scl_prefix}php-pear
@@ -46,12 +49,6 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{rele
%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
# Other third party repo stuff
-Obsoletes: php53-pecl-%{pecl_name}
-Obsoletes: php53u-pecl-%{pecl_name}
-Obsoletes: php54-pecl-%{pecl_name}
-Obsoletes: php54w-pecl-%{pecl_name}
-Obsoletes: php55u-pecl-%{pecl_name}
-Obsoletes: php55w-pecl-%{pecl_name}
Obsoletes: php56u-pecl-%{pecl_name}
Obsoletes: php56w-pecl-%{pecl_name}
Obsoletes: php70u-pecl-%{pecl_name}
@@ -93,6 +90,7 @@ sed -e 's/role="test"/role="src"/' \
mv %{pecl_name}-%{version} NTS
cd NTS
+%patch0 -p1 -b .pr37
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_LUA_VERSION/{s/.* "//;s/".*$//;p}' php_lua.h)
@@ -161,7 +159,7 @@ do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
done
-%if 0%{?fedora} < 24
+%if 0%{?fedora} < 24 && 0%{?rhel} < 8
# when pear installed alone, after us
%triggerin -- %{?scl_prefix}php-pear
if [ -x %{__pecl} ] ; then
@@ -226,6 +224,10 @@ REPORT_EXIT_STATUS=1 \
%changelog
+* Tue Jun 26 2018 Remi Collet <remi@remirepo.net> - 2.0.5-2
+- add patch for PHP 7.3 from
+ https://github.com/laruence/php-lua/pull/37
+
* Mon Jan 1 2018 Remi Collet <remi@remirepo.net> - 2.0.5-1
- Update to 2.0.5