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