Skip to content

Commit 0eb02b8

Browse files
laruencesmalyshev
authored andcommitted
Revert "Implemented FR #61602 Allow access to name of constant used as default value"
This reverts commit 054f3e3. See: http://news.php.net/php.cvs/69137 and the author confirmed. Will commit later after the author fixed this then make a new PR. Conflicts: ext/reflection/php_reflection.c
1 parent b595b77 commit 0eb02b8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/reflection/php_reflection.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2588,6 +2588,15 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
25882588
if (!(param && precv)) {
25892589
return;
25902590
}
2591+
if (param->offset < param->required) {
2592+
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional");
2593+
return;
2594+
}
2595+
precv = _get_recv_op((zend_op_array*)param->fptr, param->offset);
2596+
if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2_type == IS_UNUSED) {
2597+
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error");
2598+
return;
2599+
}
25912600

25922601
*return_value = *precv->op2.zv;
25932602
INIT_PZVAL(return_value);

0 commit comments

Comments
 (0)