1--TEST-- 2mysqli_set_opt() 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifemb.inc'); 7require_once('skipifconnectfailure.inc'); 8?> 9--FILE-- 10<?php 11 require_once("connect.inc"); 12 13 $tmp = NULL; 14 $link = NULL; 15 16 if (!is_null($tmp = @mysqli_set_opt())) 17 printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 18 19 if (!is_null($tmp = @mysqli_set_opt($link))) 20 printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 21 22 $link = mysqli_init(); 23 24 if (!is_null($tmp = @mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT))) 25 printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 26 27 if (!is_null($tmp = @mysqli_set_opt($link, "s", 'extra_my.cnf'))) 28 printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 29 30 if (!is_null($tmp = @mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0', 'foo'))) 31 printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 32 33 // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n"; 34 var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf')); 35 var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf')); 36 var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10)); 37 var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1)); 38 var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0')); 39 var_dump(my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)); 40 var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf')); 41 var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf')); 42 var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10)); 43 var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1)); 44 var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0')); 45 var_dump(mysqli_set_opt($link, MYSQLI_CLIENT_SSL, 'not an mysqli_option')); 46 47 mysqli_close($link); 48 49 var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1')); 50 51 print "done!"; 52?> 53--EXPECTF-- 54bool(true) 55bool(true) 56bool(true) 57bool(true) 58bool(true) 59bool(true) 60bool(true) 61bool(true) 62bool(true) 63bool(true) 64bool(true) 65bool(false) 66 67Warning: mysqli_set_opt(): Couldn't fetch mysqli in %s on line %d 68NULL 69done! 70