@@ -1595,9 +1595,12 @@ public function testinfo() {
1595
1595
// INFO COMMANDSTATS
1596
1596
$ info = $ this ->redis ->info ("COMMANDSTATS " );
1597
1597
1598
- foreach ($ info as $ k => $ value ) {
1599
- $ this ->assertTrue (strpos ($ k , 'cmdstat_ ' ) !== false );
1600
- }
1598
+ $ this ->assertTrue (is_array ($ info ));
1599
+ if (is_array ($ info )) {
1600
+ foreach ($ info as $ k => $ value ) {
1601
+ $ this ->assertTrue (strpos ($ k , 'cmdstat_ ' ) !== false );
1602
+ }
1603
+ }
1601
1604
}
1602
1605
1603
1606
public function testSelect () {
@@ -1617,16 +1620,16 @@ public function testMset() {
1617
1620
1618
1621
$ this ->assertFalse ($ this ->redis ->mset (array ())); // set ø → FALSE
1619
1622
1620
-
1623
+
1621
1624
/*
1622
1625
* Integer keys
1623
1626
*/
1624
1627
1625
- // No prefix
1626
- $ set_array = Array (-1 => 'neg1 ' , -2 => 'neg2 ' , -3 => 'neg3 ' , 1 => 'one ' , 2 => 'two ' , '3 ' => 'three ' );
1627
- $ this ->redis ->delete (array_keys ($ set_array ));
1628
- $ this ->assertTrue ($ this ->redis ->mset ($ set_array ));
1629
- $ this ->assertEquals ($ this ->redis ->mget (array_keys ($ set_array )), array_values ($ set_array ));
1628
+ // No prefix
1629
+ $ set_array = Array (-1 => 'neg1 ' , -2 => 'neg2 ' , -3 => 'neg3 ' , 1 => 'one ' , 2 => 'two ' , '3 ' => 'three ' );
1630
+ $ this ->redis ->delete (array_keys ($ set_array ));
1631
+ $ this ->assertTrue ($ this ->redis ->mset ($ set_array ));
1632
+ $ this ->assertEquals ($ this ->redis ->mget (array_keys ($ set_array )), array_values ($ set_array ));
1630
1633
$ this ->redis ->delete (array_keys ($ set_array ));
1631
1634
1632
1635
// With a prefix
@@ -3013,7 +3016,7 @@ public function testScript() {
3013
3016
// None should exist
3014
3017
$ result = $ this ->redis ->script ('exists ' , $ s1_sha , $ s2_sha , $ s3_sha );
3015
3018
$ this ->assertTrue (is_array ($ result ) && count ($ result ) == 3 );
3016
- $ this ->assertTrue (count (array_filter ($ result )) == 0 );
3019
+ $ this ->assertTrue (is_array ( $ result ) && count (array_filter ($ result )) == 0 );
3017
3020
3018
3021
// Load them up
3019
3022
$ this ->assertTrue ($ this ->redis ->script ('load ' , $ s1_src ) == $ s1_sha );
@@ -3022,7 +3025,7 @@ public function testScript() {
3022
3025
3023
3026
// They should all exist
3024
3027
$ result = $ this ->redis ->script ('exists ' , $ s1_sha , $ s2_sha , $ s3_sha );
3025
- $ this ->assertTrue (count (array_filter ($ result )) == 3 );
3028
+ $ this ->assertTrue (is_array ( $ result ) && count (array_filter ($ result )) == 3 );
3026
3029
}
3027
3030
3028
3031
public function testEval () {
@@ -3093,7 +3096,7 @@ public function testEval() {
3093
3096
3094
3097
// Now run our script, and check our values against each other
3095
3098
$ eval_result = $ this ->redis ->eval ($ nested_script );
3096
- $ this ->assertTrue (count ($ this ->array_diff_recursive ($ eval_result , $ expected )) == 0 );
3099
+ $ this ->assertTrue (is_array ( $ eval_result ) && count ($ this ->array_diff_recursive ($ eval_result , $ expected )) == 0 );
3097
3100
3098
3101
/*
3099
3102
* Nested reply wihin a multi/pipeline block
@@ -3109,7 +3112,7 @@ public function testEval() {
3109
3112
$ replies = $ this ->redis ->exec ();
3110
3113
3111
3114
foreach ($ replies as $ reply ) {
3112
- $ this ->assertTrue (count ($ this ->array_diff_recursive ($ reply , $ expected )) == 0 );
3115
+ $ this ->assertTrue (is_array ( $ reply ) && count ($ this ->array_diff_recursive ($ reply , $ expected )) == 0 );
3113
3116
}
3114
3117
}
3115
3118
0 commit comments