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