summaryrefslogtreecommitdiff
path: root/ext/mysqli/tests/bug36802.phpt
blob: c0bace8aaf6d7e353a337bf29167d9ffc8b1e3e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--TEST--
Bug #36802 (crashes with with mysqli_set_charset())
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
    class really_my_mysqli extends mysqli {
        function __construct()
        {
        }
    }

    require_once("connect.inc");
    $mysql = mysqli_init();

    /* following operations should not work */
    if (method_exists($mysql, 'set_charset')) {
        try {
            $mysql->set_charset('utf8');
        } catch (Error $exception) {
            echo $exception->getMessage() . "\n";
        }
    } else {
        $x[0] = false;
    }

    try {
        $mysql->query("SELECT 'foo' FROM DUAL");
    } catch (Error $exception) {
        echo $exception->getMessage() . "\n";
    }

    /* following operations should work */
    $x[1] = ($mysql->error);
    $x[2] = $mysql->errno;

    $mysql->close();

    var_dump($x);
?>
--EXPECT--
mysqli object is not fully initialized
mysqli object is not fully initialized
array(2) {
  [1]=>
  string(0) ""
  [2]=>
  int(0)
}