summaryrefslogtreecommitdiffstats
path: root/yaf-pr289.patch
diff options
context:
space:
mode:
Diffstat (limited to 'yaf-pr289.patch')
-rw-r--r--yaf-pr289.patch145
1 files changed, 145 insertions, 0 deletions
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,