diff options
-rw-r--r-- | Zend/tests/022.phpt | 24 | ||||
-rw-r--r-- | Zend/zend_compile.c | 2 |
2 files changed, 25 insertions, 1 deletions
diff --git a/Zend/tests/022.phpt b/Zend/tests/022.phpt new file mode 100644 index 0000000000..1226e2719f --- /dev/null +++ b/Zend/tests/022.phpt @@ -0,0 +1,24 @@ +--TEST-- +Implementating abstracting methods and optional parameters +--FILE-- +<?php + +abstract class Base +{ + abstract function someMethod($param); +} + +class Ext extends Base +{ + function someMethod($param = "default") + { + echo $param, "\n"; + } +} + +$a = new Ext(); +$a->someMethod("foo"); +$a->someMethod(); +--EXPECT-- +foo +default diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 18082c60bb..f8b380388d 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2283,7 +2283,7 @@ static zend_bool zend_do_perform_implementation_check(zend_function *fe, zend_fu } /* check number of arguments */ - if (proto->common.required_num_args != fe->common.required_num_args + if (proto->common.required_num_args < fe->common.required_num_args || proto->common.num_args > fe->common.num_args) { return 0; } |