diff options
author | Xinchen Hui <laruence@php.net> | 2012-08-01 20:23:30 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2012-08-01 20:23:30 +0800 |
commit | 10642aa9e4f1eb694a8f7b514cc234cb24545744 (patch) | |
tree | 57ee8aa9ad7ceb5702db9c1d1424a08ab616d77a /ext/reflection | |
parent | 645f84e41bbda22c7a19326cd1a7df7994678976 (diff) | |
download | php-git-10642aa9e4f1eb694a8f7b514cc234cb24545744.tar.gz |
Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result)
Diffstat (limited to 'ext/reflection')
-rw-r--r-- | ext/reflection/php_reflection.c | 4 | ||||
-rw-r--r-- | ext/reflection/tests/bug62715.phpt | 17 |
2 files changed, 18 insertions, 3 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index e98652ba23..23c9044981 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2379,9 +2379,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueAvailable) { RETURN_FALSE; } - if (param->offset < param->required) { - RETURN_FALSE; - } + precv = _get_recv_op((zend_op_array*)param->fptr, param->offset); if (!precv || precv->opcode != ZEND_RECV_INIT || precv->op2.op_type == IS_UNUSED) { RETURN_FALSE; diff --git a/ext/reflection/tests/bug62715.phpt b/ext/reflection/tests/bug62715.phpt new file mode 100644 index 0000000000..721d484c71 --- /dev/null +++ b/ext/reflection/tests/bug62715.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result) +--FILE-- +<?php + +function test(PDO $a = null, $b = 0, array $c) {} +$r = new ReflectionFunction('test'); + +foreach ($r->getParameters() as $p) { + var_dump($p->isDefaultValueAvailable()); +} + +?> +--EXPECT-- +bool(true) +bool(true) +bool(false) |