cvs: ZendEngine2(PHP_5_3) / zend_closures.c

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

  Modified files:              (Branch: PHP_5_3)
    /ZendEngine2	zend_closures.c 
  Log:
  Disable closures serialization/unserialization 
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_closures.c?r1=1.3.2.9&r2=1.3.2.10&diff_format=u
Index: ZendEngine2/zend_closures.c
diff -u ZendEngine2/zend_closures.c:1.3.2.9 ZendEngine2/zend_closures.c:1.3.2.10
--- ZendEngine2/zend_closures.c:1.3.2.9	Thu Jul 31 07:10:33 2008
+++ ZendEngine2/zend_closures.c	Thu Aug  7 13:35:51 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_closures.c,v 1.3.2.9 2008/07/31 07:10:33 dmitry Exp $ */
+/* $Id: zend_closures.c,v 1.3.2.10 2008/08/07 13:35:51 dmitry Exp $ */
 
 #include "zend.h"
 #include "zend_API.h"
@@ -79,6 +79,20 @@
 }
 /* }}} */
 
+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 @@
 	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.