@@ -874,7 +874,7 @@ protected function createRequest($component, $destination, array $args, $mode)
874
874
throw new InvalidLinkException ("Unknown signal ' $ signal', missing handler {$ reflection ->getName ()}:: $ method() " );
875
875
}
876
876
// convert indexed parameters to named
877
- self ::argsToParams (get_class ($ component ), $ method , $ args );
877
+ self ::argsToParams (get_class ($ component ), $ method , $ args, [], $ mode === ' test ' );
878
878
}
879
879
880
880
// counterpart of IStatePersistent
@@ -915,12 +915,8 @@ protected function createRequest($component, $destination, array $args, $mode)
915
915
if (array_key_exists (0 , $ args )) {
916
916
throw new InvalidLinkException ("Unable to pass parameters to action ' $ presenter: $ action', missing corresponding method. " );
917
917
}
918
-
919
- } elseif ($ destination === 'this ' ) {
920
- self ::argsToParams ($ presenterClass , $ method , $ args , $ this ->params );
921
-
922
918
} else {
923
- self ::argsToParams ($ presenterClass , $ method , $ args );
919
+ self ::argsToParams ($ presenterClass , $ method , $ args, $ destination === ' this ' ? $ this -> params : [], $ mode === ' test ' );
924
920
}
925
921
926
922
// counterpart of IStatePersistent
@@ -1004,11 +1000,12 @@ protected function createRequest($component, $destination, array $args, $mode)
1004
1000
* @param string method name
1005
1001
* @param array arguments
1006
1002
* @param array supplemental arguments
1003
+ * @param bool prevents 'Missing parameter' exception
1007
1004
* @return void
1008
1005
* @throws InvalidLinkException
1009
1006
* @internal
1010
1007
*/
1011
- public static function argsToParams ($ class , $ method , & $ args , $ supplemental = [])
1008
+ public static function argsToParams ($ class , $ method , & $ args , $ supplemental = [], $ ignoreMissing = FALSE )
1012
1009
{
1013
1010
$ i = 0 ;
1014
1011
$ rm = new \ReflectionMethod ($ class , $ method );
@@ -1029,7 +1026,7 @@ public static function argsToParams($class, $method, & $args, $supplemental = []
1029
1026
}
1030
1027
1031
1028
if (!isset ($ args [$ name ])) {
1032
- if ($ param ->isDefaultValueAvailable () || $ type === 'NULL ' || $ type === 'array ' ) {
1029
+ if ($ param ->isDefaultValueAvailable () || $ type === 'NULL ' || $ type === 'array ' || $ ignoreMissing ) {
1033
1030
continue ;
1034
1031
}
1035
1032
throw new InvalidLinkException ("Missing parameter \$$ name required by $ class:: {$ rm ->getName ()}() " );
0 commit comments