1--TEST-- 2Bug #35517 (mysqli_stmt_fetch returns NULL) 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifconnectfailure.inc'); 7?> 8--FILE-- 9<?php 10 require_once("connect.inc"); 11 12 $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); 13 14 $mysql->query("CREATE TABLE temp (id INT UNSIGNED NOT NULL)"); 15 $mysql->query("INSERT INTO temp (id) VALUES (3000000897),(3800001532),(3900002281),(3100059612)"); 16 $stmt = $mysql->prepare("SELECT id FROM temp"); 17 $stmt->execute(); 18 $stmt->bind_result($id); 19 while ($stmt->fetch()) { 20 if (PHP_INT_SIZE == 8) { 21 if ((gettype($id) !== 'int') && (gettype($id) != 'integer')) 22 printf("[001] Expecting integer on 64bit got %s/%s\n", gettype($id), var_export($id, true)); 23 } else { 24 if (gettype($id) !== 'string') { 25 printf("[002] Expecting string on 32bit got %s/%s\n", gettype($id), var_export($id, true)); 26 } 27 } 28 print $id; 29 print "\n"; 30 } 31 $stmt->close(); 32 33 $mysql->query("DROP TABLE temp"); 34 $mysql->close(); 35 print "done!"; 36?> 37--CLEAN-- 38<?php 39require_once("connect.inc"); 40if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 41 printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); 42 43if (!mysqli_query($link, "DROP TABLE IF EXISTS temp")) 44 printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 45 46mysqli_close($link); 47?> 48--EXPECTF-- 493000000897 503800001532 513900002281 523100059612 53done! 54