Skip to content

Commit e200c7a

Browse files
committed
Merge branch 'PHP-5.4'
2 parents c1a7369 + 170ee90 commit e200c7a

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

ext/reflection/php_reflection.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,11 +1477,6 @@ static parameter_reference *_reflection_param_get_default_param(INTERNAL_FUNCTIO
14771477
return NULL;
14781478
}
14791479

1480-
if (param->offset < param->required) {
1481-
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Parameter is not optional");
1482-
return NULL;
1483-
}
1484-
14851480
return param;
14861481
}
14871482
/* }}} */
@@ -1497,7 +1492,7 @@ static zend_op *_reflection_param_get_default_precv(INTERNAL_FUNCTION_PARAMETERS
14971492

14981493
precv = _get_recv_op((zend_op_array*)param->fptr, param->offset);
14991494
if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2_type == IS_UNUSED) {
1500-
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error");
1495+
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Internal error: Failed to retrieve the default value");
15011496
return NULL;
15021497
}
15031498

ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ foreach($reflect->getParameters() as $param) {
1818
}
1919
}
2020
?>
21-
==DONE==
2221
--EXPECT--
23-
Parameter is not optional
22+
Internal error: Failed to retrieve the default value
2423
CONST_TEST_1
25-
==DONE==

ext/reflection/tests/bug62715.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@ foreach ($r->getParameters() as $p) {
1010
var_dump($p->isDefaultValueAvailable());
1111
}
1212

13+
foreach ($r->getParameters() as $p) {
14+
if ($p->isDefaultValueAvailable()) {
15+
var_dump($p->getDefaultValue());
16+
}
17+
}
1318
?>
1419
--EXPECT--
1520
bool(true)
1621
bool(true)
1722
bool(false)
23+
NULL
24+
int(0)

0 commit comments

Comments
 (0)