summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2018-11-12 07:32:32 +0100
committerRemi Collet <remi@remirepo.net>2018-11-12 07:32:32 +0100
commit90c7782c811a87c3ac062ba3efed80b28f0f4604 (patch)
tree8a061ad0dcd127fd2634db77c42737295fe6d462
parentcb1f9d5414956bb14d221ad4fde75df27e04e122 (diff)
update to 0.8.0
drop patch merged upstream raise dependency on PHP 5.6 raise dependency on libmustache 0.5.0 open https://github.com/jbboehr/php-mustache/pull/52 missing file
-rw-r--r--48.patch119
-rw-r--r--PHPINFO7
-rw-r--r--REFLECTION57
-rw-r--r--php-pecl-mustache.spec30
-rw-r--r--php5to7.h43
5 files changed, 63 insertions, 193 deletions
diff --git a/48.patch b/48.patch
deleted file mode 100644
index 5b8edf1..0000000
--- a/48.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-From a6b22a380212ff2db890587669088d241d4e65bc Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@remirepo.net>
-Date: Thu, 28 Jun 2018 08:46:45 +0200
-Subject: [PATCH] fix for PHP 7.3 and Array/Object recursion protection
-
----
- .gitignore | 1 +
- mustache_data.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 44 insertions(+)
-
-diff --git a/mustache_data.cpp b/mustache_data.cpp
-index a73168c..c129eaa 100644
---- a/mustache_data.cpp
-+++ b/mustache_data.cpp
-@@ -267,10 +267,19 @@ static zend_always_inline void mustache_data_from_array_zval(mustache::Data * no
-
- data_hash = HASH_OF(current);
-
-+#if PHP_VERSION_ID < 70300
- if( ZEND_HASH_APPLY_PROTECTION(data_hash) && ++data_hash->u.v.nApplyCount > 1 ) {
- php_error(E_WARNING, "Data includes circular reference");
- data_hash->u.v.nApplyCount--;
- return;
-+#else
-+ if (!(GC_FLAGS(data_hash) & GC_IMMUTABLE)) {
-+ if (GC_IS_RECURSIVE(data_hash)) {
-+ php_error(E_WARNING, "Data includes circular reference");
-+ return;
-+ }
-+ GC_PROTECT_RECURSION(data_hash);
-+#endif
- }
-
- data_count = zend_hash_num_elements(data_hash);
-@@ -309,8 +318,13 @@ static zend_always_inline void mustache_data_from_array_zval(mustache::Data * no
- }
- } ZEND_HASH_FOREACH_END();
-
-+#if PHP_VERSION_ID < 70300
- if( ZEND_HASH_APPLY_PROTECTION(data_hash) ) {
- data_hash->u.v.nApplyCount--;
-+#else
-+ if (!(GC_FLAGS(data_hash) & GC_IMMUTABLE)) {
-+ GC_UNPROTECT_RECURSION(data_hash);
-+#endif
- }
- }
- #endif
-@@ -417,12 +431,22 @@ static zend_always_inline void mustache_data_from_object_properties_zval(mustach
- data_hash = Z_OBJ_HT_P(current)->get_properties(current TSRMLS_CC);
- }
- if( data_hash != NULL && zend_hash_num_elements(data_hash) > 0 ) {
-+#if PHP_VERSION_ID < 70300
- if( ZEND_HASH_APPLY_PROTECTION(data_hash) && ++data_hash->u.v.nApplyCount > 1 ) {
- php_error(E_WARNING, "Data includes circular reference");
- data_hash->u.v.nApplyCount--;
- return;
-+#else
-+ if (!(GC_FLAGS(data_hash) & GC_IMMUTABLE)) {
-+ if (GC_IS_RECURSIVE(data_hash)) {
-+ php_error(E_WARNING, "Data includes circular reference");
-+ return;
-+ }
-+ GC_PROTECT_RECURSION(data_hash);
-+#endif
- }
-
-+
- ZEND_HASH_FOREACH_KEY_VAL_IND(data_hash, key_nindex, key, data_entry) {
- (void)key_nindex; /* avoid [-Wunused-but-set-variable] */
- if( key && ZSTR_LEN(key) && ZSTR_VAL(key)[0] ) { // skip private/protected
-@@ -451,8 +475,13 @@ static zend_always_inline void mustache_data_from_object_properties_zval(mustach
- }
- } ZEND_HASH_FOREACH_END();
-
-+#if PHP_VERSION_ID < 70300
- if( ZEND_HASH_APPLY_PROTECTION(data_hash) ) {
- data_hash->u.v.nApplyCount--;
-+#else
-+ if (!(GC_FLAGS(data_hash) & GC_IMMUTABLE)) {
-+ GC_UNPROTECT_RECURSION(data_hash);
-+#endif
- }
- }
- }
-@@ -519,10 +548,19 @@ static zend_always_inline void mustache_data_from_object_functions_zval(mustache
- data_hash = &ce->function_table;
- }
- if( data_hash != NULL && zend_hash_num_elements(data_hash) > 0 ) {
-+#if PHP_VERSION_ID < 70300
- if( ZEND_HASH_APPLY_PROTECTION(data_hash) && ++data_hash->u.v.nApplyCount > 1 ) {
- php_error(E_WARNING, "Data includes circular reference");
- data_hash->u.v.nApplyCount--;
- return;
-+#else
-+ if (!(GC_FLAGS(data_hash) & GC_IMMUTABLE)) {
-+ if (GC_IS_RECURSIVE(data_hash)) {
-+ php_error(E_WARNING, "Data includes circular reference");
-+ return;
-+ }
-+ GC_PROTECT_RECURSION(data_hash);
-+#endif
- }
-
- ZEND_HASH_FOREACH_KEY_VAL_IND(data_hash, key_nindex, key, data_entry) {
-@@ -542,8 +580,13 @@ static zend_always_inline void mustache_data_from_object_functions_zval(mustache
- }
- } ZEND_HASH_FOREACH_END();
-
-+#if PHP_VERSION_ID < 70300
- if( ZEND_HASH_APPLY_PROTECTION(data_hash) ) {
- data_hash->u.v.nApplyCount--;
-+#else
-+ if (!(GC_FLAGS(data_hash) & GC_IMMUTABLE)) {
-+ GC_UNPROTECT_RECURSION(data_hash);
-+#endif
- }
- }
- }
diff --git a/PHPINFO b/PHPINFO
index 77baf13..722c153 100644
--- a/PHPINFO
+++ b/PHPINFO
@@ -1,11 +1,10 @@
mustache
-Version => 0.7.4
-Released => 2017-07-18
+Version => 0.8.0
+Released => 2018-11-11
Revision => master
Authors => John Boehr <jbboehr@gmail.com> (lead)
Spec Version => 1.1.2
-Libmustache Version => 0.4.4
-Libmustache Operand Size => 2
+Libmustache Version => 0.5.0
c++11 unordered map support => enabled
diff --git a/REFLECTION b/REFLECTION
index cae9955..be5449b 100644
--- a/REFLECTION
+++ b/REFLECTION
@@ -1,6 +1,6 @@
-Extension [ <persistent> extension #116 mustache version 0.7.4 ] {
+Extension [ <persistent> extension #119 mustache version 0.8.0 ] {
- - Classes [8] {
+ - Classes [7] {
Class [ <internal:mustache> class MustacheAST ] {
- Constants [0] {
@@ -50,43 +50,6 @@ Extension [ <persistent> extension #116 mustache version 0.7.4 ] {
}
}
- Class [ <internal:mustache> class MustacheCode ] {
-
- - Constants [0] {
- }
-
- - Static properties [0] {
- }
-
- - Static methods [0] {
- }
-
- - Properties [1] {
- Property [ <default> protected $binaryString ]
- }
-
- - Methods [3] {
- Method [ <internal:mustache, ctor> public method __construct ] {
-
- - Parameters [1] {
- Parameter #0 [ <optional> $codeString ]
- }
- }
-
- Method [ <internal:mustache> public method toReadableString ] {
-
- - Parameters [0] {
- }
- }
-
- Method [ <internal:mustache> public method __toString ] {
-
- - Parameters [0] {
- }
- }
- }
- }
-
Class [ <internal:mustache> class Mustache ] {
- Constants [0] {
@@ -101,7 +64,7 @@ Extension [ <persistent> extension #116 mustache version 0.7.4 ] {
- Properties [0] {
}
- - Methods [13] {
+ - Methods [11] {
Method [ <internal:mustache, ctor> public method __construct ] {
- Parameters [0] {
@@ -147,20 +110,6 @@ Extension [ <persistent> extension #116 mustache version 0.7.4 ] {
}
}
- Method [ <internal:mustache> public method compile ] {
-
- - Parameters [1] {
- Parameter #0 [ <required> $tmpl ]
- }
- }
-
- Method [ <internal:mustache> public method execute ] {
-
- - Parameters [1] {
- Parameter #0 [ <required> $code ]
- }
- }
-
Method [ <internal:mustache> public method parse ] {
- Parameters [1] {
diff --git a/php-pecl-mustache.spec b/php-pecl-mustache.spec
index 8914e71..0fcaaf4 100644
--- a/php-pecl-mustache.spec
+++ b/php-pecl-mustache.spec
@@ -13,31 +13,25 @@
%global pecl_name mustache
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
-%if "%{php_version}" < "5.6"
-%global ini_name %{pecl_name}.ini
-%else
%global ini_name 40-%{pecl_name}.ini
-%endif
%global with_tests 0%{!?_without_tests:1}
-%global upstream_version 0.7.4
+%global upstream_version 0.8.0
#global upstream_prever RC2
Summary: Mustache templating language
Name: %{?sub_prefix}php-pecl-%{pecl_name}
Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
-Release: 5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
License: MIT
-Group: Development/Languages
URL: http://pecl.php.net/package/%{pecl_name}
Source0: http://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz
-
-Patch0: https://patch-diff.githubusercontent.com/raw/jbboehr/php-mustache/pull/48.patch
+Source1: https://raw.githubusercontent.com/jbboehr/php-mustache/master/php5to7.h
BuildRequires: %{?dtsprefix}gcc
-BuildRequires: %{?scl_prefix}php-devel >= 5.4
+BuildRequires: %{?scl_prefix}php-devel >= 5.6
BuildRequires: %{?scl_prefix}php-pear
-BuildRequires: pkgconfig(mustache)
+BuildRequires: pkgconfig(mustache) >= 0.5.0
%if 0%{?rhel} == 7
BuildRequires: devtoolset-6-toolchain
%else
@@ -103,7 +97,7 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
-%patch0 -p1 -b .pr48
+cp %{SOURCE1} .
# Sanity check, really often broken
extver=$(sed -n '/PHP_MUSTACHE_VERSION/{s/.* "//;s/".*$//;p}' php_mustache.h)
@@ -198,10 +192,6 @@ fi
%check
-%if 0%{?fedora} >= 28
-rm ?TS/tests/MustacheCode__toReadableString.phpt
-%endif
-
: Minimal load test for NTS extension
cd NTS
%{__php} --no-php-ini \
@@ -251,7 +241,15 @@ REPORT_EXIT_STATUS=1 \
%endif
+# Notice no more EL-6 build (compiler issue and segfaults)
%changelog
+* Mon Nov 12 2018 Remi Collet <remi@remirepo.net> - 0.8.0-1
+- update to 0.8.0
+- drop patch merged upstream
+- raise dependency on PHP 5.6
+- raise dependency on libmustache 0.5.0
+- open https://github.com/jbboehr/php-mustache/pull/52 missing file
+
* Thu Aug 16 2018 Remi Collet <remi@remirepo.net> - 0.7.4-5
- rebuild for 7.3.0beta2 new ABI
diff --git a/php5to7.h b/php5to7.h
new file mode 100644
index 0000000..84fd3dd
--- /dev/null
+++ b/php5to7.h
@@ -0,0 +1,43 @@
+
+#ifndef PHP_MUSTACHE_PHP5TO7
+#define PHP_MUSTACHE_PHP5TO7
+
+#if PHP_MAJOR_VERSION >= 7
+#include <zend_string.h>
+#endif
+
+#if PHP_MAJOR_VERSION < 7
+#define _add_next_index_string(...) add_next_index_string(__VA_ARGS__, 1)
+#define _add_assoc_string(...) add_assoc_string(__VA_ARGS__, 1)
+#define _add_assoc_string_ex(...) add_assoc_string_ex(__VA_ARGS__, 1)
+#define _add_assoc_stringl_ex(...) add_assoc_stringl_ex(__VA_ARGS__, 1)
+#define _RETURN_STRING(a) RETURN_STRING(a, 1)
+#define _RETVAL_STRING(a) RETVAL_STRING(a, 1)
+#define _RETVAL_STRINGL(a, b) RETVAL_STRINGL(a, b, 1)
+#define _DECLARE_ZVAL(name) zval * name
+#define _INIT_ZVAL INIT_ZVAL
+#define _ALLOC_INIT_ZVAL(name) ALLOC_INIT_ZVAL(name)
+#define _STRS ZEND_STRS
+#define _zend_read_property(a, b, c, d, e, f) zend_read_property(a, b, c, d, e TSRMLS_CC)
+#define _zend_register_internal_class_ex(class, parent) zend_register_internal_class_ex(class, parent, NULL TSRMLS_CC)
+#define _ZVAL_STRINGL(a, b, c) ZVAL_STRINGL(a, b, c, 1)
+typedef int strsize_t;
+#else
+#define _add_next_index_string add_next_index_string
+#define _add_assoc_string(z, k, s) add_assoc_string_ex(z, k, strlen(k)+1, s)
+#define _add_assoc_string_ex add_assoc_string_ex
+#define _add_assoc_stringl_ex add_assoc_stringl_ex
+#define _RETURN_STRING(a) RETURN_STRING(a)
+#define _RETVAL_STRING(a) RETVAL_STRING(a)
+#define _RETVAL_STRINGL RETVAL_STRINGL
+#define _DECLARE_ZVAL(name) zval name ## _v; zval * name = &name ## _v
+#define _INIT_ZVAL ZVAL_NULL
+#define _ALLOC_INIT_ZVAL(name) ZVAL_NULL(name)
+#define _STRS ZEND_STRL
+#define _zend_read_property(a, b, c, d, e, f) zend_read_property(a, b, c, d, e, f)
+#define _zend_register_internal_class_ex zend_register_internal_class_ex
+#define _ZVAL_STRINGL ZVAL_STRINGL
+typedef size_t strsize_t;
+#endif
+
+#endif /* PHP_MUSTACHE_PHP5TO7 */