xref: /PHP-7.1/ext/mysqli/tests/bug55582.phpt (revision 7af945e2)
1--TEST--
2Bug #55582 mysqli_num_rows() returns always 0 for unbuffered, when mysqlnd is used
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7require_once("connect.inc");
8?>
9--FILE--
10<?php
11	include "connect.inc";
12	if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) {
13		printf("[001] Cannot connect to the server");
14	}
15
16	var_dump($link->real_query("SELECT 1"));
17	$res = $link->use_result();
18	var_dump(mysqli_num_rows($res));
19	var_dump($res->fetch_assoc());
20	var_dump(mysqli_num_rows($res));
21	var_dump($res->fetch_assoc());
22	var_dump(mysqli_num_rows($res));
23
24	$link->close();
25	echo "done\n";
26?>
27--EXPECTF--
28bool(true)
29
30Warning: mysqli_num_rows(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d
31int(0)
32array(1) {
33  [1]=>
34  string(1) "1"
35}
36
37Warning: mysqli_num_rows(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d
38int(0)
39NULL
40int(1)
41done
42