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