mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
- Prevent instantiation from Reflection
This commit is contained in:
parent
9535ca53b1
commit
c20bde9779
1 changed files with 14 additions and 1 deletions
|
@ -315,11 +315,24 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp TSRMLS_
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
/* {{{ 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) /* {{{ */
|
void zend_register_closure_ce(TSRMLS_D) /* {{{ */
|
||||||
{
|
{
|
||||||
zend_class_entry ce;
|
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 = zend_register_internal_class(&ce TSRMLS_CC);
|
||||||
zend_ce_closure->ce_flags |= ZEND_ACC_FINAL_CLASS;
|
zend_ce_closure->ce_flags |= ZEND_ACC_FINAL_CLASS;
|
||||||
zend_ce_closure->create_object = zend_closure_new;
|
zend_ce_closure->create_object = zend_closure_new;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue