diff options
| author | Dmitry Stogov <dmitry@php.net> | 2008-08-07 13:35:51 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2008-08-07 13:35:51 +0000 |
| commit | ba15f6809d01aab5d2bdd82210b44cc4d009c572 (patch) | |
| tree | d61eb489d9a3751346dd163af91e908cef0a4ffe | |
| parent | c0dbad5530ad161d6085788d0bd60283cabe80db (diff) | |
| download | php-git-ba15f6809d01aab5d2bdd82210b44cc4d009c572.tar.gz | |
Disable closures serialization/unserialization
| -rw-r--r-- | Zend/zend_closures.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 04821e330a..130ce0c4bb 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -79,6 +79,20 @@ static zend_function *zend_closure_get_constructor(zval *object TSRMLS_DC) /* {{ } /* }}} */ +static int zend_closure_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */ +{ + zend_error(E_ERROR, "Serialization of 'Closure' is not allowed"); + return FAILURE; +} +/* }}} */ + +static int zend_closure_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */ +{ + zend_error(E_ERROR, "Unserialization of 'Closure' is not allowed"); + return FAILURE; +} +/* }}} */ + static int zend_closure_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ { return (Z_OBJ_HANDLE_P(o1) != Z_OBJ_HANDLE_P(o2)); @@ -196,6 +210,8 @@ void zend_register_closure_ce(TSRMLS_D) /* {{{ */ zend_ce_closure = zend_register_internal_class(&ce TSRMLS_CC); zend_ce_closure->ce_flags |= ZEND_ACC_FINAL_CLASS; zend_ce_closure->create_object = zend_closure_new; + zend_ce_closure->serialize = zend_closure_serialize; + zend_ce_closure->unserialize = zend_closure_unserialize; memcpy(&closure_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); closure_handlers.get_constructor = zend_closure_get_constructor; |
