...but don't remove the code. Calling isset( $bar['foo'] ) without checking
that $bar is an array seems not very nice to me.
Change-Id: I822c925b6f36bf34902f8075e54f71fe4f6d2566
*/
public static function newAccelerator( $params = [], $fallback = null ) {
if ( $fallback === null ) {
- // The is_array check here is needed because in PHP 5.3:
- // $a = 'hash'; isset( $params['fallback'] ); yields true
if ( is_array( $params ) && isset( $params['fallback'] ) ) {
$fallback = $params['fallback'];
} elseif ( !is_array( $params ) ) {
foreach ( $info['globals'] as $key => $val ) {
// If a merge strategy is set, read it and remove it from the value
// so it doesn't accidentally end up getting set.
- // Need to check $val is an array for PHP 5.3 which will return
- // true on isset( 'string'['foo'] ).
- if ( isset( $val[self::MERGE_STRATEGY] ) && is_array( $val ) ) {
+ if ( is_array( $val ) && isset( $val[self::MERGE_STRATEGY] ) ) {
$mergeStrategy = $val[self::MERGE_STRATEGY];
unset( $val[self::MERGE_STRATEGY] );
} else {