Skip to content

Commit 349e8c6

Browse files
committed
Update PHONGO_PARSE_PARAMETERS_NONE macro for PHP < 7.3
1 parent 7beb720 commit 349e8c6

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

phongo_compat.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,6 @@
169169
} while (0)
170170
#endif /* PHP_VERSION_ID < 70300 */
171171

172-
/* For compatibility with older PHP versions */
173-
#ifndef ZEND_PARSE_PARAMETERS_NONE
174-
#define ZEND_PARSE_PARAMETERS_NONE() \
175-
ZEND_PARSE_PARAMETERS_START(0, 0) \
176-
ZEND_PARSE_PARAMETERS_END()
177-
#endif
178-
179172
/* Compatibility macros to override error handling logic */
180173
#define PHONGO_PARSE_PARAMETERS_START(min_num_args, max_num_args) \
181174
do { \
@@ -193,6 +186,21 @@
193186
} \
194187
while (0)
195188

189+
#ifndef ZEND_PARSE_PARAMETERS_NONE
190+
#define PHONGO_PARSE_PARAMETERS_NONE \
191+
do { \
192+
zend_error_handling error_handling; \
193+
zend_replace_error_handling( \
194+
EH_THROW, \
195+
phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), \
196+
&error_handling); \
197+
if (zend_parse_parameters_none() == FAILURE) { \
198+
zend_restore_error_handling(&error_handling); \
199+
return; \
200+
} \
201+
zend_restore_error_handling(&error_handling); \
202+
} while (0)
203+
#else
196204
#define PHONGO_PARSE_PARAMETERS_NONE \
197205
do { \
198206
zend_error_handling error_handling; \
@@ -206,6 +214,7 @@
206214
return; \
207215
} \
208216
} while (0)
217+
#endif
209218

210219
void phongo_add_exception_prop(const char* prop, int prop_len, zval* value);
211220
zend_bool php_phongo_zend_hash_apply_protection_begin(HashTable* ht);

0 commit comments

Comments
 (0)