cvs: ZendEngine2 / zend_closures.c

"Dmitry Stogov" <[email protected]>
Newsgroups gmane.comp.php.cvs.zend
Message-ID <cvsdmitry1218116173@cvsserver>
dmitry		Thu Aug  7 13:36:13 2008 UTC

  Modified files:              
    /ZendEngine2	zend_closures.c 
  Log:
  Disable closures serialization/unserialization
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_closures.c?r1=1.10&r2=1.11&diff_format=u
Index: ZendEngine2/zend_closures.c
diff -u ZendEngine2/zend_closures.c:1.10 ZendEngine2/zend_closures.c:1.11
--- ZendEngine2/zend_closures.c:1.10	Thu Jul 31 07:10:42 2008
+++ ZendEngine2/zend_closures.c	Thu Aug  7 13:36:13 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_closures.c,v 1.10 2008/07/31 07:10:42 dmitry Exp $ */
+/* $Id: zend_closures.c,v 1.11 2008/08/07 13:36:13 dmitry Exp $ */
 
 #include "zend.h"
 #include "zend_API.h"
@@ -79,6 +79,20 @@
 }
 /* }}} */
 
+static int zend_closure_serialize(zval *object, int *type, zstr *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, int type, const zstr 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));
@@ -201,6 +215,8 @@
 	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;



-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.