1--TEST--
2mysqli_real_escape_string() - sjis
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once __DIR__ . '/test_setup/test_helpers.inc';
8$link = mysqli_connect_or_skip();
9if (!mysqli_set_charset($link, 'sjis'))
10    die(sprintf("skip Cannot set charset 'sjis'"));
11?>
12--FILE--
13<?php
14    require_once 'table.inc';
15
16    var_dump(mysqli_set_charset($link, "sjis"));
17
18    if ('?p??\\\\?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??\\?p??')))
19        printf("[004] Expecting \\\\, got %s\n", $tmp);
20
21    if ('?p??\"?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??"?p??')))
22        printf("[005] Expecting \", got %s\n", $tmp);
23
24    if ("?p??\'?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??'?p??")))
25        printf("[006] Expecting ', got %s\n", $tmp);
26
27    if ("?p??\\n?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\n?p??")))
28        printf("[007] Expecting \\n, got %s\n", $tmp);
29
30    if ("?p??\\r?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\r?p??")))
31        printf("[008] Expecting \\r, got %s\n", $tmp);
32
33    if ("?p??\\0?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??" . chr(0) . "?p??")))
34        printf("[009] Expecting %s, got %s\n", "?p??\\0?p??", $tmp);
35
36    var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '?p')"));
37
38    mysqli_close($link);
39    print "done!";
40?>
41--EXPECT--
42bool(true)
43bool(true)
44done!
45