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