cvs: ZendEngine2(PHP_5_3) / zend_closures.c
[email protected] ("Marcus Boerger")
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <cvshelly1231010995@cvsserver> |
helly Sat Jan 3 19:29:55 2009 UTC
Modified files: (Branch: PHP_5_3)
/ZendEngine2 zend_closures.c
Log:
- MFH Prevent instantiation from Reflection
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_closures.c?r1=1.3.2.22&r2=1.3.2.23&diff_format=u
Index: ZendEngine2/zend_closures.c
diff -u ZendEngine2/zend_closures.c:1.3.2.22 ZendEngine2/zend_closures.c:1.3.2.23
--- ZendEngine2/zend_closures.c:1.3.2.22 Sat Jan 3 18:22:20 2009
+++ ZendEngine2/zend_closures.c Sat Jan 3 19:29:55 2009
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_closures.c,v 1.3.2.22 2009/01/03 18:22:20 helly Exp $ */
+/* $Id: zend_closures.c,v 1.3.2.23 2009/01/03 19:29:55 helly Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -310,11 +310,24 @@
}
/* }}} */
+/* {{{ proto Closure::__construct()
+ Private constructor preventing instantiation */
+ZEND_METHOD(Closure, __construct)
+{
+ zend_error(E_RECOVERABLE_ERROR, "Instantiation of 'Closure' is not allowed");
+}
+/* }}} */
+
+static const zend_function_entry closure_functions[] = {
+ ZEND_ME(Closure, __construct, NULL, ZEND_ACC_PRIVATE)
+ {NULL, NULL, NULL}
+};
+
void zend_register_closure_ce(TSRMLS_D) /* {{{ */
{
zend_class_entry ce;
- INIT_CLASS_ENTRY(ce, "Closure", NULL);
+ INIT_CLASS_ENTRY(ce, "Closure", closure_functions);
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;