summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-06-11 10:42:41 +0200
committerRemi Collet <fedora@famillecollet.com>2016-06-11 10:42:41 +0200
commitb3500f62994353b8e652dcc71a6ac8d940b6bb92 (patch)
tree44e986f09fddef30103eedd7ef1976372a954cee
parentdb65f42dcab8d10ced47c12fa9cbbfa675e5f229 (diff)
php-pecl-yaf: add patch for PHP 7.1
-rw-r--r--php-pecl-yaf-php7.spec19
-rw-r--r--yaf-pr289.patch145
2 files changed, 161 insertions, 3 deletions
diff --git a/php-pecl-yaf-php7.spec b/php-pecl-yaf-php7.spec
index 66dcadf..e53ddde 100644
--- a/php-pecl-yaf-php7.spec
+++ b/php-pecl-yaf-php7.spec
@@ -8,10 +8,9 @@
#
%if 0%{?scl:1}
%global sub_prefix %{scl_prefix}
+%scl_package php-pecl-yaf
%endif
-%{?scl: %scl_package php-pecl-yaf}
-
%global gh_commit 51e458e9746d7061efc565d49baaca26feacd7ff
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner laruence
@@ -28,7 +27,7 @@ Version: 3.0.2
Release: 0.8.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz
%else
-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;')}}
Source: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz
%endif
License: PHP
@@ -36,6 +35,8 @@ Group: Development/Languages
URL: http://pecl.php.net/package/yaf
Source1: %{pecl_name}.ini
+Patch0: %{pecl_name}-pr289.patch
+
BuildRequires: %{?scl_prefix}php-devel >= 7
BuildRequires: %{?scl_prefix}php-pear
BuildRequires: pcre-devel
@@ -48,8 +49,10 @@ Provides: %{?scl_prefix}php-%{pecl_name} = %{version}
Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}
Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version}
Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version}
+%if "%{?scl_prefix}" != "%{?sub_prefix}"
Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release}
Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release}
+%endif
%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1}
# Other third party repo stuff
@@ -63,6 +66,10 @@ Obsoletes: php56u-pecl-%{pecl_name} <= %{version}
Obsoletes: php56w-pecl-%{pecl_name} <= %{version}
Obsoletes: php70u-pecl-%{pecl_name} <= %{version}
Obsoletes: php70w-pecl-%{pecl_name} <= %{version}
+%if "%{php_version}" > "7.1"
+Obsoletes: php71u-pecl-%{pecl_name} <= %{version}
+Obsoletes: php71w-pecl-%{pecl_name} <= %{version}
+%endif
%endif
%if 0%{?fedora} < 20 && 0%{?rhel} < 7
@@ -94,6 +101,8 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
+%patch0 -p1 -b .pr289
+
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_YAF_VERSION/{s/.*\t"//;s/".*$//;p}' php_yaf.h )
if test "x${extver}" != "x%{version}%{?gh_date:-dev}"; then
@@ -210,6 +219,10 @@ fi
%changelog
+* Sat Jun 11 2016 Remi Collet <remi@fedoraproject.org> - 3.0.2-3
+- add patch for PHP 7.1
+ open https://github.com/laruence/yaf/pull/289
+
* Sun Mar 6 2016 Remi Collet <remi@fedoraproject.org> - 3.0.2-2
- adapt for F24
diff --git a/yaf-pr289.patch b/yaf-pr289.patch
new file mode 100644
index 0000000..c0d8bc9
--- /dev/null
+++ b/yaf-pr289.patch
@@ -0,0 +1,145 @@
+From bd6ffea2ca669a1614d15fdd7322994a7c50e4d0 Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora@famillecollet.com>
+Date: Sat, 11 Jun 2016 08:14:00 +0200
+Subject: [PATCH] fix for PHP 7.1
+
+---
+ requests/yaf_request_simple.c | 2 ++
+ views/yaf_view_simple.c | 35 +++++++++++++++++++++++++++++++++--
+ yaf_loader.c | 4 ++++
+ 3 files changed, 39 insertions(+), 2 deletions(-)
+
+diff --git a/requests/yaf_request_simple.c b/requests/yaf_request_simple.c
+index 475e424..efd5934 100644
+--- a/requests/yaf_request_simple.c
++++ b/requests/yaf_request_simple.c
+@@ -254,8 +254,10 @@ YAF_STARTUP_FUNCTION(request_simple){
+ yaf_request_simple_ce = zend_register_internal_class_ex(&ce, yaf_request_ce);
+ yaf_request_simple_ce->ce_flags |= ZEND_ACC_FINAL;
+
++#if PHP_VERSION_ID < 70100
+ zend_declare_class_constant_string(yaf_request_simple_ce, ZEND_STRL("SCHEME_HTTP"), "http");
+ zend_declare_class_constant_string(yaf_request_simple_ce, ZEND_STRL("SCHEME_HTTPS"), "https");
++#endif
+
+ return SUCCESS;
+ }
+diff --git a/views/yaf_view_simple.c b/views/yaf_view_simple.c
+index 700661d..e436433 100644
+--- a/views/yaf_view_simple.c
++++ b/views/yaf_view_simple.c
+@@ -102,12 +102,17 @@ static int yaf_view_simple_extract(zval *tpl_vars, zval *vars) /* {{{ */ {
+
+ if (tpl_vars && Z_TYPE_P(tpl_vars) == IS_ARRAY) {
+ ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(tpl_vars), var_name, entry) {
++#if PHP_VERSION_ID < 70100
++ zend_class_entry *scope = EG(scope);
++#else
++ zend_class_entry *scope = zend_get_executed_scope();
++#endif
+ /* GLOBALS protection */
+ if (zend_string_equals_literal(var_name, "GLOBALS")) {
+ continue;
+ }
+
+- if (zend_string_equals_literal(var_name, "this") && EG(scope) && ZSTR_LEN(EG(scope)->name) != 0) {
++ if (zend_string_equals_literal(var_name, "this") && scope && ZSTR_LEN(scope->name) != 0) {
+ continue;
+ }
+
+@@ -121,12 +126,17 @@ static int yaf_view_simple_extract(zval *tpl_vars, zval *vars) /* {{{ */ {
+
+ if (vars && Z_TYPE_P(vars) == IS_ARRAY) {
+ ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(vars), var_name, entry) {
++#if PHP_VERSION_ID < 70100
++ zend_class_entry *scope = EG(scope);
++#else
++ zend_class_entry *scope = zend_get_executed_scope();
++#endif
+ /* GLOBALS protection */
+ if (zend_string_equals_literal(var_name, "GLOBALS")) {
+ continue;
+ }
+
+- if (zend_string_equals_literal(var_name, "this") && EG(scope) && ZSTR_LEN(EG(scope)->name) != 0) {
++ if (zend_string_equals_literal(var_name, "this") && scope && ZSTR_LEN(scope->name) != 0) {
+ continue;
+ }
+
+@@ -257,15 +267,24 @@ int yaf_view_simple_display(yaf_view_t *view, zval *tpl, zval *vars, zval *ret)
+
+ (void)yaf_view_simple_extract(tpl_vars, vars);
+
++#if PHP_VERSION_ID < 70100
+ old_scope = EG(scope);
+ EG(scope) = yaf_view_simple_ce;
++#else
++ old_scope = EG(fake_scope);
++ EG(fake_scope) = yaf_view_simple_ce;
++#endif
+
+ if (IS_ABSOLUTE_PATH(Z_STRVAL_P(tpl), Z_STRLEN_P(tpl))) {
+ script = Z_STRVAL_P(tpl);
+ len = Z_STRLEN_P(tpl);
+ if (yaf_loader_import(script, len, 0) == 0) {
+ yaf_trigger_error(YAF_ERR_NOTFOUND_VIEW, "Failed opening template %s: %s" , script, strerror(errno));
++#if PHP_VERSION_ID < 70100
+ EG(scope) = old_scope;
++#else
++ EG(fake_scope) = old_scope;
++#endif
+ return 0;
+ }
+ } else {
+@@ -278,7 +297,11 @@ int yaf_view_simple_display(yaf_view_t *view, zval *tpl, zval *vars, zval *ret)
+ yaf_trigger_error(YAF_ERR_NOTFOUND_VIEW,
+ "Could not determine the view script path, you should call %s::setScriptPath to specific it",
+ ZSTR_VAL(yaf_view_simple_ce->name));
++#if PHP_VERSION_ID < 70100
+ EG(scope) = old_scope;
++#else
++ EG(fake_scope) = old_scope;
++#endif
+ return 0;
+ }
+ } else {
+@@ -288,13 +311,21 @@ int yaf_view_simple_display(yaf_view_t *view, zval *tpl, zval *vars, zval *ret)
+ if (yaf_loader_import(script, len, 0) == 0) {
+ yaf_trigger_error(YAF_ERR_NOTFOUND_VIEW, "Failed opening template %s: %s", script, strerror(errno));
+ efree(script);
++#if PHP_VERSION_ID < 70100
+ EG(scope) = old_scope;
++#else
++ EG(fake_scope) = old_scope;
++#endif
+ return 0;
+ }
+ efree(script);
+ }
+
++#if PHP_VERSION_ID < 70100
+ EG(scope) = old_scope;
++#else
++ EG(fake_scope) = old_scope;
++#endif
+
+ return 1;
+ }
+diff --git a/yaf_loader.c b/yaf_loader.c
+index a345d58..d5cd20a 100644
+--- a/yaf_loader.c
++++ b/yaf_loader.c
+@@ -83,9 +83,13 @@ int yaf_loader_register(yaf_loader_t *loader) /* {{{ */ {
+ do {
+ zend_fcall_info fci = {
+ sizeof(fci),
++#if PHP_VERSION_ID < 70100
+ EG(function_table),
++#endif
+ function,
++#if PHP_VERSION_ID < 70100
+ NULL,
++#endif
+ &ret,
+ params,
+ NULL,