Skip to content

Commit 5d7796b

Browse files
remicolletalcaeus
andauthored
PHPC-1922 Update PHONGO_CE_DISABLE_SERIALIZATION for PHP 8.1 (#1240)
* Fix API change in 8.1.0beta1 * cleanup uneeded semicolon * Fix clang-format complaints Co-authored-by: Andreas Braun <[email protected]>
1 parent d555cc5 commit 5d7796b

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

php_phongo.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,20 @@ bool php_phongo_manager_unregister(php_phongo_manager_t* manager);
167167
#define PHONGO_CE_FINAL(ce) \
168168
do { \
169169
ce->ce_flags |= ZEND_ACC_FINAL; \
170-
} while (0);
170+
} while (0)
171171

172+
#if PHP_VERSION_ID < 80100
172173
#define PHONGO_CE_DISABLE_SERIALIZATION(ce) \
173174
do { \
174175
ce->serialize = zend_class_serialize_deny; \
175176
ce->unserialize = zend_class_unserialize_deny; \
176-
} while (0);
177+
} while (0)
178+
#else
179+
#define PHONGO_CE_DISABLE_SERIALIZATION(ce) \
180+
do { \
181+
ce->ce_flags |= ZEND_ACC_NOT_SERIALIZABLE; \
182+
} while (0)
183+
#endif
177184

178185
#define PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, size) \
179186
do { \
@@ -187,15 +194,15 @@ bool php_phongo_manager_unregister(php_phongo_manager_t* manager);
187194
zend_hash_init((props), (size), NULL, ZVAL_PTR_DTOR, 0); \
188195
(intern)->properties = (props); \
189196
} \
190-
} while (0);
197+
} while (0)
191198

192199
#define PHONGO_GET_PROPERTY_HASH_FREE_PROPS(is_debug, props) \
193200
do { \
194201
if (is_debug) { \
195202
zend_hash_destroy((props)); \
196203
FREE_HASHTABLE(props); \
197204
} \
198-
} while (0);
205+
} while (0)
199206

200207
#define PHONGO_ZVAL_CLASS_OR_TYPE_NAME(zv) (Z_TYPE(zv) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE(zv)->name) : zend_get_type_by_const(Z_TYPE(zv)))
201208
#define PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zvp) PHONGO_ZVAL_CLASS_OR_TYPE_NAME(*(zvp))
@@ -205,15 +212,15 @@ bool php_phongo_manager_unregister(php_phongo_manager_t* manager);
205212
#define PHONGO_SET_CREATED_BY_PID(intern) \
206213
do { \
207214
(intern)->created_by_pid = (int) getpid(); \
208-
} while (0);
215+
} while (0)
209216

210217
#define PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern, manager) \
211218
do { \
212219
int pid = (int) getpid(); \
213220
if ((intern)->created_by_pid != pid) { \
214221
php_phongo_client_reset_once((manager), pid); \
215222
} \
216-
} while (0);
223+
} while (0)
217224

218225
#endif /* PHONGO_H */
219226

0 commit comments

Comments
 (0)