Skip to content

PHPC-1922 Update PHONGO_CE_DISABLE_SERIALIZATION for PHP 8.1 #1240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions php_phongo.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,20 @@ bool php_phongo_manager_unregister(php_phongo_manager_t* manager);
#define PHONGO_CE_FINAL(ce) \
do { \
ce->ce_flags |= ZEND_ACC_FINAL; \
} while (0);
} while (0)

#if PHP_VERSION_ID < 80100
#define PHONGO_CE_DISABLE_SERIALIZATION(ce) \
do { \
ce->serialize = zend_class_serialize_deny; \
ce->unserialize = zend_class_unserialize_deny; \
} while (0);
} while (0)
#else
#define PHONGO_CE_DISABLE_SERIALIZATION(ce) \
do { \
ce->ce_flags |= ZEND_ACC_NOT_SERIALIZABLE; \
} while (0)
#endif

#define PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, size) \
do { \
Expand All @@ -187,15 +194,15 @@ bool php_phongo_manager_unregister(php_phongo_manager_t* manager);
zend_hash_init((props), (size), NULL, ZVAL_PTR_DTOR, 0); \
(intern)->properties = (props); \
} \
} while (0);
} while (0)

#define PHONGO_GET_PROPERTY_HASH_FREE_PROPS(is_debug, props) \
do { \
if (is_debug) { \
zend_hash_destroy((props)); \
FREE_HASHTABLE(props); \
} \
} while (0);
} while (0)

#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)))
#define PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zvp) PHONGO_ZVAL_CLASS_OR_TYPE_NAME(*(zvp))
Expand All @@ -205,15 +212,15 @@ bool php_phongo_manager_unregister(php_phongo_manager_t* manager);
#define PHONGO_SET_CREATED_BY_PID(intern) \
do { \
(intern)->created_by_pid = (int) getpid(); \
} while (0);
} while (0)

#define PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern, manager) \
do { \
int pid = (int) getpid(); \
if ((intern)->created_by_pid != pid) { \
php_phongo_client_reset_once((manager), pid); \
} \
} while (0);
} while (0)

#endif /* PHONGO_H */

Expand Down