From: Kunal Mehta Date: Tue, 16 Jun 2015 23:08:44 +0000 (-0700) Subject: registration: Improve error message if a non-array attribute is set X-Git-Tag: 1.31.0-rc.0~11046^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/supprimer.php?a=commitdiff_plain;h=9cdf419be56d3568254ee9a3e7210f9ff096cca6;p=lhc%2Fweb%2Fwiklou.git registration: Improve error message if a non-array attribute is set Otherwise array_merge_recursive() will trigger a confusing and unhelpful warning. Bug: T102523 Change-Id: I7e4778cb7552fe93a08f315c9888ec64322e2501 --- diff --git a/includes/registration/ExtensionProcessor.php b/includes/registration/ExtensionProcessor.php index 0a09ff5a42..273e9ef0ba 100644 --- a/includes/registration/ExtensionProcessor.php +++ b/includes/registration/ExtensionProcessor.php @@ -290,10 +290,14 @@ class ExtensionProcessor implements Processor { /** * @param string $name - * @param mixed $value + * @param array $value * @param array &$array + * @throws InvalidArgumentException */ protected function storeToArray( $name, $value, &$array ) { + if ( !is_array( $value ) ) { + throw new InvalidArgumentException( "The value for '$name' should be an array" ); + } if ( isset( $array[$name] ) ) { $array[$name] = array_merge_recursive( $array[$name], $value ); } else {