1--TEST--
2Trying to clone mysqli_warning object
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8if (!$TEST_EXPERIMENTAL)
9    die("skip - experimental (= unsupported) feature");
10?>
11--FILE--
12<?php
13    require_once "connect.inc";
14
15    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
16        printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
17            $host, $user, $db, $port, $socket);
18
19    if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
20        printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
21
22    if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
23        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
24
25    if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
26        printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
27
28    if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
29        printf("[005] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
30    }
31
32    $warning_clone = clone $warning;
33    print "done!";
34?>
35--CLEAN--
36<?php
37require_once "clean_table.inc";
38?>
39--EXPECTF--
40Fatal error: Trying to clone an uncloneable object of class mysqli_warning in %s on line %d
41