As of PHP 7.2 counting false or null raises a "Warning: count(): Parameter must be an array or an object that implements Countable".
Bug: T182377
Bug: T196793
Change-Id: I7ca38bc55ae04f68106fe0d27c7d496da1538459
$ecount = 1; // checking individual elements
}
}
$ecount = 1; // checking individual elements
}
}
- $count = count( $val );
- if ( $ecount != $count ) {
- $this->debug( $val, __FUNCTION__, "Expected $ecount elements for $tag but got $count" );
+ $count = 1;
+ if ( is_array( $val ) ) {
+ $count = count( $val );
+ if ( $ecount != $count ) {
+ $this->debug( $val, __FUNCTION__, "Expected $ecount elements for $tag but got $count" );
+ return false;
+ }
+ // If there are multiple values, recursively validate each of them.
if ( $count > 1 ) {
foreach ( $val as $v ) {
if ( !$this->validate( $section, $tag, $v, true ) ) {
if ( $count > 1 ) {
foreach ( $val as $v ) {
if ( !$this->validate( $section, $tag, $v, true ) ) {