1--TEST--
2mysqli_real_escape_string()
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11    require 'table.inc';
12
13    if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
14        printf("[004] Expecting \\\\, got %s\n", $tmp);
15
16    if ('\"' !== ($tmp = mysqli_real_escape_string($link, '"')))
17        printf("[005] Expecting \", got %s\n", $tmp);
18
19    if ("\'" !== ($tmp = mysqli_real_escape_string($link, "'")))
20        printf("[006] Expecting ', got %s\n", $tmp);
21
22    if ("\\n" !== ($tmp = mysqli_real_escape_string($link, "\n")))
23        printf("[007] Expecting \\n, got %s\n", $tmp);
24
25    if ("\\r" !== ($tmp = mysqli_real_escape_string($link, "\r")))
26        printf("[008] Expecting \\r, got %s\n", $tmp);
27
28    if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
29        printf("[009] Expecting %s, got %s\n", "foo\\0bar", $tmp);
30
31    mysqli_close($link);
32
33    try {
34        mysqli_real_escape_string($link, 'foo');
35    } catch (Error $exception) {
36        echo $exception->getMessage() . "\n";
37    }
38
39    print "done!";
40?>
41--EXPECT--
42mysqli object is already closed
43done!
44