File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
mysqli /
tests /
mysqli_real_escape_string.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:47:58 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
mysqli_real_escape_string()
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
$tmp = NULL;
$link = NULL;
if (NULL !== ($tmp = @mysqli_real_escape_string()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysqli_real_escape_string($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
if (NULL !== ($tmp =@mysqli_real_escape_string($link, "foo", "foo")))
printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
printf("[004] Expecting \\\\, got %s\n", $tmp);
if ('\"' !== ($tmp = mysqli_real_escape_string($link, '"')))
printf("[005] Expecting \", got %s\n", $tmp);
if ("\'" !== ($tmp = mysqli_real_escape_string($link, "'")))
printf("[006] Expecting ', got %s\n", $tmp);
if ("\\n" !== ($tmp = mysqli_real_escape_string($link, "\n")))
printf("[007] Expecting \\n, got %s\n", $tmp);
if ("\\r" !== ($tmp = mysqli_real_escape_string($link, "\r")))
printf("[008] Expecting \\r, got %s\n", $tmp);
if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
printf("[009] Expecting %s, got %s\n", "foo\\0bar", $tmp);
mysqli_close($link);
if (NULL !== ($tmp = mysqli_real_escape_string($link, 'foo')))
printf("[010] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
/* Make sure that the function alias exists */
if (NULL !== ($tmp = @mysqli_escape_string()))
printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
print "done!";
?>
--EXPECTF--
Warning: mysqli_real_escape_string(): Couldn't fetch mysqli in %s on line %d
done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>