1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
From 23c34676e88ed6aef5fc6b6484a65abb554aa11a Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Tue, 25 Aug 2020 10:51:51 +0200
Subject: [PATCH 1/2] adapt for PHP 8 and missing arginfo
---
fann.c | 7 ++-----
fann_connection.c | 9 ++++++---
php_fann.h | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/fann.c b/fann.c
index da5f307..a5c2e68 100644
--- a/fann.c
+++ b/fann.c
@@ -1445,9 +1445,7 @@ static int php_fann_callback(struct fann *ann, struct fann_train_data *train,
/* set fci */
PHPC_FCALL_RETVAL(fci, retval);
- fci.params = PHPC_FCALL_PARAMS_NAME(callback);
- fci.param_count = 6;
- fci.no_separation = 0;
+ PHPC_FCALL_FCI_INIT(fci, callback, 6, 0);
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) != SUCCESS || PHPC_VAL_ISUNDEF(retval)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the user callback");
@@ -2173,8 +2171,7 @@ PHP_FUNCTION(fann_create_train_from_callback)
/* set fci */
PHPC_FCALL_RETVAL(fci, retval);
fci.params = PHPC_FCALL_PARAMS_NAME(callback);
- fci.param_count = 3;
- fci.no_separation = 0;
+ PHPC_FCALL_FCI_INIT(fci, callback, 3, 0);
/* call callback for each data */
for (i = 0; i < num_data; i++) {
diff --git a/fann_connection.c b/fann_connection.c
index 4fe818b..7580054 100644
--- a/fann_connection.c
+++ b/fann_connection.c
@@ -108,13 +108,16 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_fannconnection_set_weight, 0)
ZEND_ARG_INFO(0, weight)
ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO(arginfo_fannconnection_void, 0)
+ZEND_END_ARG_INFO()
/* }}} */
static zend_function_entry fannconnection_funcs[] = {
PHP_ME(FANNConnection, __construct, arginfo_fannconnection___construct, ZEND_ACC_CTOR | ZEND_ACC_PUBLIC)
- PHP_ME(FANNConnection, getFromNeuron, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(FANNConnection, getToNeuron, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(FANNConnection, getWeight, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(FANNConnection, getFromNeuron, arginfo_fannconnection_void, ZEND_ACC_PUBLIC)
+ PHP_ME(FANNConnection, getToNeuron, arginfo_fannconnection_void, ZEND_ACC_PUBLIC)
+ PHP_ME(FANNConnection, getWeight, arginfo_fannconnection_void, ZEND_ACC_PUBLIC)
PHP_ME(FANNConnection, setWeight, arginfo_fannconnection_set_weight, ZEND_ACC_PUBLIC)
PHPC_FE_END
};
diff --git a/php_fann.h b/php_fann.h
index 3197a67..7008c04 100644
--- a/php_fann.h
+++ b/php_fann.h
@@ -232,7 +232,7 @@ PHP_FANN_API extern zend_class_entry *php_fann_FANNConnection_class;
/* macros for dealing with FANNConnection properties */
#define PHP_FANN_CONN_PROP_NAME(__name) __name, sizeof(__name)-1
#define PHP_FANN_CONN_PROP_UPDATE(__type, __obj, __name, __value) \
- zend_update_property_##__type(php_fann_FANNConnection_class, (__obj), \
+ zend_update_property_##__type(php_fann_FANNConnection_class, PHPC_OBJ_FOR_PROP(__obj), \
PHP_FANN_CONN_PROP_NAME(__name), (__value) TSRMLS_CC)
#define PHP_FANN_CONN_PROP_DECLARE(__type, __name) \
zend_declare_property_##__type(php_fann_FANNConnection_class, PHP_FANN_CONN_PROP_NAME(__name), \
From f7bfc3d254d24f35462d03ccce19597bae593d38 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 2 Sep 2020 09:39:38 +0200
Subject: [PATCH 2/2] fix for 8.0.0beta3
---
fann.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fann.c b/fann.c
index a5c2e68..68dd96b 100644
--- a/fann.c
+++ b/fann.c
@@ -1618,7 +1618,8 @@ PHP_FUNCTION(fann_destroy)
return;
}
- RETURN_BOOL(PHPC_RES_CLOSE(z_ann) == SUCCESS);
+ PHPC_RES_CLOSE(z_ann);
+ RETURN_TRUE;
}
/* }}} */
@@ -2242,7 +2243,8 @@ PHP_FUNCTION(fann_destroy_train)
return;
}
- RETURN_BOOL(PHPC_RES_CLOSE(z_train_data) == SUCCESS);
+ PHPC_RES_CLOSE(z_train_data);
+ RETURN_TRUE;
}
/* }}} */
|