1--TEST--
2mysqli_set_opt()
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once('skipifconnectfailure.inc');
8?>
9--FILE--
10<?php
11    require_once("connect.inc");
12
13    $link = mysqli_init();
14
15    // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
16    var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
17    var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
18    var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
19    var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1));
20    var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
21    var_dump(my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket));
22    var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
23    var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
24    var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
25    var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1));
26    var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
27    var_dump(mysqli_set_opt($link, MYSQLI_CLIENT_SSL, 'not an mysqli_option'));
28
29    mysqli_close($link);
30
31    try {
32        mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1');
33    } catch (Error $exception) {
34        echo $exception->getMessage() . "\n";
35    }
36
37    print "done!";
38?>
39--EXPECT--
40bool(true)
41bool(true)
42bool(true)
43bool(true)
44bool(true)
45bool(true)
46bool(true)
47bool(true)
48bool(true)
49bool(true)
50bool(true)
51bool(false)
52mysqli object is already closed
53done!
54