@@ -117,8 +117,10 @@ memory_limit=83886080
117117 return false ;
118118 }
119119
120- reset ($ expected );
121- while ((list ($ k , $ v ) = each ($ expected )) && mysqli_stmt_fetch ($ stmt )) {
120+ foreach ($ expected as $ k => $ v ) {
121+ if (!mysqli_stmt_fetch ($ stmt )) {
122+ break ;
123+ }
122124 if ($ result !== $ v ) {
123125 printf ("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s. \n" ,
124126 $ offset + 8 ,
@@ -269,9 +271,10 @@ memory_limit=83886080
269271 break ;
270272 }
271273
272- reset ($ values );
273- while (mysqli_stmt_fetch ($ stmt )) {
274- list ($ exp_trend , $ exp_targetport ) = each ($ values );
274+ foreach ($ values as $ exp_trend => $ exp_targetport ) {
275+ if (!mysqli_stmt_fetch ($ stmt )) {
276+ break ;
277+ }
275278 if ($ targetport != $ exp_targetport ) {
276279 printf ("[306] Values fetched from MySQL seem to be wrong, check manually \n" );
277280 printf ("%s/%s - %s/%s - '%s' \n" , $ trend , $ exp_trend , $ targetport , $ exp_targetport , $ format );
@@ -308,9 +311,10 @@ memory_limit=83886080
308311 break ;
309312 }
310313
311- reset ($ values );
312- while ($ stmt ->fetch ()) {
313- list ($ exp_trend , $ exp_targetport ) = each ($ values );
314+ foreach ($ values as $ exp_trend => $ exp_targetport ) {
315+ if (!$ stmt ->fetch ()) {
316+ break ;
317+ }
314318 if ($ targetport != $ exp_targetport ) {
315319 printf ("[312] Values fetched from MySQL seem to be wrong, check manually \n" );
316320 printf ("%s/%s - %s/%s - '%s' \n" , $ trend , $ exp_trend , $ targetport , $ exp_targetport , $ format );
@@ -334,4 +338,4 @@ memory_limit=83886080
334338 require_once ("clean_table.inc " );
335339?>
336340--EXPECTF--
337- done!
341+ done!
0 commit comments