diff --git a/ext/mysqli/tests/mysqli_stmt_get_result.phpt b/ext/mysqli/tests/mysqli_stmt_get_result.phpt index bfaf111dd6a..e043f198bd3 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result.phpt @@ -28,9 +28,8 @@ require_once 'skipifconnectfailure.inc'; if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - // FIXME - different versions return different values ?! - if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp)) - printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + if (false !== ($tmp = mysqli_stmt_get_result($stmt))) + printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true)); if (!mysqli_stmt_execute($stmt)) printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -39,7 +38,7 @@ require_once 'skipifconnectfailure.inc'; printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); if (is_object($tmp = mysqli_stmt_store_result($stmt))) - printf("[009] non-object, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + printf("[009] non-object, got %s/%s\n", gettype($tmp), var_export($tmp, true)); mysqli_stmt_close($stmt); @@ -56,15 +55,14 @@ require_once 'skipifconnectfailure.inc'; if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - // FIXME - different versions return different values ?! - if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp)) - printf("[013] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + if (false !== ($tmp = mysqli_stmt_get_result($stmt))) + printf("[013] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true)); if (!mysqli_stmt_execute($stmt)) printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!is_object($tmp = mysqli_stmt_get_result($stmt))) - printf("[016] NULL, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + if (! ($tmp = mysqli_stmt_get_result($stmt)) instanceof mysqli_result) + printf("[016] Expecting mysqli_result, got %s/%s\n", gettype($tmp), var_export($tmp, true)); mysqli_free_result($tmp); mysqli_stmt_close($stmt); @@ -83,25 +81,25 @@ require_once 'skipifconnectfailure.inc'; printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); if (false !== ($tmp = mysqli_stmt_get_result($stmt))) - printf("[020] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + printf("[020] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true)); if (!mysqli_stmt_execute($stmt)) printf("[023] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!is_object($tmp = mysqli_stmt_get_result($stmt))) - printf("[024] Expecting object, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + if (! ($tmp = mysqli_stmt_get_result($stmt)) instanceof mysqli_result) + printf("[024] Expecting mysqli_result, got %s/%s\n", gettype($tmp), var_export($tmp, true)); if (false !== ($tmp = mysqli_stmt_fetch($stmt))) - printf("[025] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + printf("[025] false, got %s/%s\n", gettype($tmp), var_export($tmp, true)); if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) { printf("[026] [%d] [%s]\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); printf("[027] [%d] [%s]\n", mysqli_errno($link), mysqli_error($link)); - printf("[028] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + printf("[028] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, true)); } if (false !== ($tmp = mysqli_stmt_fetch($stmt))) - printf("[029] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + printf("[029] false, got %s/%s\n", gettype($tmp), var_export($tmp, true)); mysqli_stmt_close($stmt); @@ -135,11 +133,11 @@ require_once 'skipifconnectfailure.inc'; $id = NULL; $label = NULL; if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) - printf("[037] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + printf("[037] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, true)); - if (!is_object($tmp = $result = mysqli_stmt_get_result($stmt))) - printf("[038] Expecting array, got %s/%s, [%d] %s\n", - gettype($tmp), var_export($tmp, 1), + if (! ($result = mysqli_stmt_get_result($stmt)) instanceof mysqli_result) + printf("[038] Expecting mysqli_result, got %s/%s, [%d] %s\n", + gettype($result), var_export($result, true), mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); if (false !== ($tmp = mysqli_stmt_fetch($stmt))) @@ -155,23 +153,23 @@ require_once 'skipifconnectfailure.inc'; $link->real_query('KILL '.mysqli_thread_id($link)); // We kill our own connection so we should get "Query execution was interrupted" - if ($link->errno !== 1317) - printf("[042] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + if ($link->errno !== 1317) + printf("[042] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_stmt_get_result($stmt))) - printf("[043] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + if (false !== ($tmp = mysqli_stmt_get_result($stmt))) + printf("[043] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true)); - mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt); - try { + try { mysqli_stmt_fetch($stmt); } catch (Error $exception) { echo $exception->getMessage(), "\n"; } - mysqli_close($link); + mysqli_close($link); - print "done!"; + print "done!"; ?> --CLEAN--