[php] Adjust #required params for subclass methods

If the same method name is implemented in a parent class then the
subclass can't have more required parameters than that or else we
get a compatibility error when the module is loaded.

The testsuite wasn't catching this problem because it was no longer
trying to load the modules for testcases without _runme.php, because
the mechanism to do that relied on there being a generated .php
wrapper, which we no longer have by default.  Fix that to provide a
regression test for this fix.

See #2151
This commit is contained in:
Olly Betts 2022-06-12 10:12:02 +12:00
commit 9cdf46e8c8
5 changed files with 29 additions and 15 deletions

View file

@ -22,19 +22,19 @@ check::equal($a->ping(), "MyFoo::ping()", "MyFoo::ping failed");
check::equal($a->pong(), "Foo::pong();MyFoo::ping()", "MyFoo::pong failed");
class MyExample1 extends Example1 {
function Color($r, $g, $b) {
function Color($r, $g = NULL, $b = NULL) {
return $r;
}
}
class MyExample2 extends Example1 {
function Color($r, $g, $b) {
function Color($r, $g = NULL, $b = NULL) {
return $g;
}
}
class MyExample3 extends Example1 {
function Color($r, $g, $b) {
function Color($r, $g = NULL, $b = NULL) {
return $b;
}
}