1--TEST-- 2mysqli_set_local_infile_handler() - close database link 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifemb.inc'); 7require_once('skipifconnectfailure.inc'); 8 9if (!function_exists('mysqli_set_local_infile_handler')) 10 die("skip - function not available."); 11 12require_once('connect.inc'); 13if (!$TEST_EXPERIMENTAL) 14 die("skip - experimental (= unsupported) feature"); 15 16if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 17 die("skip Cannot connect to MySQL"); 18 19include_once("local_infile_tools.inc"); 20if ($msg = check_local_infile_support($link, $engine)) 21 die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error)); 22 23mysqli_close($link); 24?> 25--INI-- 26mysqli.allow_local_infile=1 27--FILE-- 28<?php 29 require("table.inc"); 30 require_once('local_infile_tools.inc'); 31 32 function callback_close_link($fp, &$buffer, $buflen, &$error) { 33 global $link; 34 static $invocation = 0; 35 36 printf("Callback: %d\n", $invocation++); 37 flush(); 38 if (is_object($link)) 39 mysqli_close($link); 40 41 $buffer = "1;'a';\n"; 42 if ($invocation > 10) 43 return 0; 44 45 return strlen($buffer); 46 } 47 48 $file = create_standard_csv(1); 49 $expected = array(array('id' => 1, 'label' => 'a')); 50 try_handler(20, $link, $file, 'callback_close_link', $expected); 51 mysqli_close($link); 52 print "done!"; 53?> 54--CLEAN-- 55<?php 56 require_once("clean_table.inc"); 57?> 58--EXPECTF-- 59Callback set to 'callback_close_link' 60Callback: 0 61done!