Permalink
Browse files

Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wron…

…g result)
  • Loading branch information...
1 parent 645f84e commit 10642aa9e4f1eb694a8f7b514cc234cb24545744 @laruence laruence committed Aug 1, 2012
Showing with 22 additions and 3 deletions.
  1. +4 −0 NEWS
  2. +1 −3 ext/reflection/php_reflection.c
  3. +17 −0 ext/reflection/tests/bug62715.phpt
View
4 NEWS
@@ -13,6 +13,10 @@ PHP NEWS
- DateTime:
. Fixed Bug #62500 (Segfault in DateInterval class when extended). (Laruence)
+- Reflection:
+ . Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong
+ result). (Laruence)
+
- SPL:
. Fixed bug #62616 (ArrayIterator::count() from IteratorIterator instance
gives Segmentation fault). (Laruence, Gustavo)
@@ -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;
@@ -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)

0 comments on commit 10642aa

Please sign in to comment.