Skip to content

Commit 39ea21a

Browse files
committed
add ZEND_PARSE_PARAMETERS_NONE to private constructors
1 parent 11a9574 commit 39ea21a

File tree

12 files changed

+28
-0
lines changed

12 files changed

+28
-0
lines changed

Zend/zend_closures.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,8 @@ static HashTable *zend_closure_get_gc(zend_object *obj, zval **table, int *n) /*
724724
/* {{{ Private constructor preventing instantiation */
725725
ZEND_COLD ZEND_METHOD(Closure, __construct)
726726
{
727+
ZEND_PARSE_PARAMETERS_NONE();
728+
727729
zend_throw_error(NULL, "Instantiation of class Closure is not allowed");
728730
}
729731
/* }}} */

Zend/zend_fibers.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,8 @@ ZEND_METHOD(Fiber, getCurrent)
10991099

11001100
ZEND_METHOD(FiberError, __construct)
11011101
{
1102+
ZEND_PARSE_PARAMETERS_NONE();
1103+
11021104
zend_throw_error(
11031105
NULL,
11041106
"The \"%s\" class is reserved for internal use and cannot be manually instantiated",

Zend/zend_interfaces.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,8 @@ static zend_result zend_internal_iterator_ensure_rewound(zend_internal_iterator
550550

551551

552552
ZEND_METHOD(InternalIterator, __construct) {
553+
ZEND_PARSE_PARAMETERS_NONE();
554+
553555
zend_throw_error(NULL, "Cannot manually construct InternalIterator");
554556
}
555557

Zend/zend_weakrefs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ static HashTable *zend_weakref_get_debug_info(zend_object *object, int *is_temp)
312312

313313
ZEND_COLD ZEND_METHOD(WeakReference, __construct)
314314
{
315+
ZEND_PARSE_PARAMETERS_NONE();
316+
315317
zend_throw_error(NULL, "Direct instantiation of WeakReference is not allowed, use WeakReference::create instead");
316318
}
317319

ext/dom/node.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,6 +2741,8 @@ PHP_METHOD(Dom_Node, compareDocumentPosition)
27412741

27422742
PHP_METHOD(Dom_Node, __construct)
27432743
{
2744+
ZEND_PARSE_PARAMETERS_NONE();
2745+
27442746
zend_throw_error(NULL, "Cannot directly construct %s, use document methods instead", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
27452747
}
27462748

ext/hash/hash.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,8 @@ PHP_FUNCTION(hash_equals)
11321132

11331133
/* {{{ */
11341134
PHP_METHOD(HashContext, __construct) {
1135+
ZEND_PARSE_PARAMETERS_NONE();
1136+
11351137
/* Normally unreachable as private/final */
11361138
zend_throw_exception(zend_ce_error, "Illegal call to private/final constructor", 0);
11371139
}

ext/intl/breakiterator/breakiterator_methods.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ using icu::Locale;
3636

3737
U_CFUNC PHP_METHOD(IntlBreakIterator, __construct)
3838
{
39+
ZEND_PARSE_PARAMETERS_NONE();
40+
3941
zend_throw_exception( NULL,
4042
"An object of this type cannot be created with the new operator",
4143
0 );

ext/intl/calendar/calendar_methods.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ using icu::Locale;
6565

6666
U_CFUNC PHP_METHOD(IntlCalendar, __construct)
6767
{
68+
ZEND_PARSE_PARAMETERS_NONE();
69+
6870
zend_throw_exception( NULL,
6971
"An object of this type cannot be created with the new operator",
7072
0 );

ext/intl/timezone/timezone_methods.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ using icu::Calendar;
4141

4242
U_CFUNC PHP_METHOD(IntlTimeZone, __construct)
4343
{
44+
ZEND_PARSE_PARAMETERS_NONE();
45+
4446
zend_throw_exception( NULL,
4547
"An object of this type cannot be created with the new operator",
4648
0 );

ext/reflection/php_reflection.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7274,6 +7274,8 @@ ZEND_METHOD(ReflectionZendExtension, getCopyright)
72747274
/* {{{ Dummy constructor -- always throws ReflectionExceptions. */
72757275
ZEND_METHOD(ReflectionReference, __construct)
72767276
{
7277+
ZEND_PARSE_PARAMETERS_NONE();
7278+
72777279
_DO_THROW(
72787280
"Cannot directly instantiate ReflectionReference. "
72797281
"Use ReflectionReference::fromArrayElement() instead"
@@ -7363,12 +7365,16 @@ ZEND_METHOD(ReflectionReference, getId)
73637365

73647366
ZEND_METHOD(ReflectionAttribute, __construct)
73657367
{
7368+
ZEND_PARSE_PARAMETERS_NONE();
7369+
73667370
_DO_THROW("Cannot directly instantiate ReflectionAttribute");
73677371
}
73687372

73697373
ZEND_METHOD(ReflectionAttribute, __clone)
73707374
{
73717375
/* __clone() is private but this is reachable with reflection */
7376+
ZEND_PARSE_PARAMETERS_NONE();
7377+
73727378
_DO_THROW("Cannot clone object using __clone()");
73737379
}
73747380

0 commit comments

Comments
 (0)