From d6dbf4ba4130c04a057c3917b77e560205f10076 Mon Sep 17 00:00:00 2001
From: "Meredith L. Patterson" <mlp@thesmartpolitenerd.com>
Date: Sat, 21 Dec 2013 19:46:57 +0100
Subject: [PATCH] SWIG doesn't like adding TSRMLS_* macros to fn decls, so
 TSRMLS_FETCH it is

---
 src/bindings/php/hammer.i | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/bindings/php/hammer.i b/src/bindings/php/hammer.i
index f24a0634..7f9b9d36 100644
--- a/src/bindings/php/hammer.i
+++ b/src/bindings/php/hammer.i
@@ -146,7 +146,7 @@
       for (int i=0; i < token->token_data.seq->used; i++) {
 	zval *tmp;
 	ALLOC_INIT_ZVAL(tmp);
-	hpt_to_php(token->token_data.seq->elements[i], tmp TSRMLS_CC);
+	hpt_to_php(token->token_data.seq->elements[i], tmp);
 	add_next_index_zval(return_value, tmp);
       }
       break;
@@ -176,11 +176,10 @@
     MAKE_STD_ZVAL(args[0]);
     ALLOC_INIT_ZVAL(ret);
     ZVAL_STRING(&func, (const char*)user_data, 0);
-    hpt_to_php(p->ast, args[0] TSRMLS_CC);
+    hpt_to_php(p->ast, args[0]);
     int ok = call_user_function(EG(function_table), NULL, &func, ret, 1, args TSRMLS_CC);
     if (ok != SUCCESS) {
-      printf("call_user_function failed\n");
-      // FIXME throw some error
+      zend_throw_exception(zend_exception_get_default(TSRMLS_C), "call_action failed", 0 TSRMLS_CC);
       return NULL;
     }
     // Whatever the zval is, stuff it into a token
@@ -197,11 +196,10 @@
     MAKE_STD_ZVAL(args[0]);
     ALLOC_INIT_ZVAL(ret);
     ZVAL_STRING(&func, (const char*)user_data, 0);
-    hpt_to_php(p->ast, args[0] TSRMLS_CC);
+    hpt_to_php(p->ast, args[0]);
     int ok = call_user_function(EG(function_table), NULL, &func, ret, 1, args TSRMLS_CC);
     if (ok != SUCCESS) {
-      printf("call_user_function failed\n");
-      // FIXME throw some error
+      zend_throw_exception(zend_exception_get_default(TSRMLS_C), "call_predicate failed", 0 TSRMLS_CC);
       return 0;
     }
     return Z_LVAL_P(ret);
-- 
GitLab