@@ -1595,9 +1595,12 @@ public function testinfo() {
15951595 // INFO COMMANDSTATS
15961596 $ info = $ this ->redis ->info ("COMMANDSTATS " );
15971597
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+ }
16011604 }
16021605
16031606 public function testSelect () {
@@ -1617,16 +1620,16 @@ public function testMset() {
16171620
16181621 $ this ->assertFalse ($ this ->redis ->mset (array ())); // set ø → FALSE
16191622
1620-
1623+
16211624 /*
16221625 * Integer keys
16231626 */
16241627
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 ));
16301633 $ this ->redis ->delete (array_keys ($ set_array ));
16311634
16321635 // With a prefix
@@ -3013,7 +3016,7 @@ public function testScript() {
30133016 // None should exist
30143017 $ result = $ this ->redis ->script ('exists ' , $ s1_sha , $ s2_sha , $ s3_sha );
30153018 $ 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 );
30173020
30183021 // Load them up
30193022 $ this ->assertTrue ($ this ->redis ->script ('load ' , $ s1_src ) == $ s1_sha );
@@ -3022,7 +3025,7 @@ public function testScript() {
30223025
30233026 // They should all exist
30243027 $ 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 );
30263029 }
30273030
30283031 public function testEval () {
@@ -3093,7 +3096,7 @@ public function testEval() {
30933096
30943097 // Now run our script, and check our values against each other
30953098 $ 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 );
30973100
30983101 /*
30993102 * Nested reply wihin a multi/pipeline block
@@ -3109,7 +3112,7 @@ public function testEval() {
31093112 $ replies = $ this ->redis ->exec ();
31103113
31113114 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 );
31133116 }
31143117 }
31153118
0 commit comments