Annotation of embedaddon/php/ext/mysqli/tests/mysqli_real_escape_string.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mysqli_real_escape_string()
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: require_once('skipifemb.inc');
! 7: require_once('skipifconnectfailure.inc');
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11: require_once("connect.inc");
! 12:
! 13: $tmp = NULL;
! 14: $link = NULL;
! 15:
! 16: if (NULL !== ($tmp = @mysqli_real_escape_string()))
! 17: printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 18:
! 19: if (NULL !== ($tmp = @mysqli_real_escape_string($link)))
! 20: printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 21:
! 22: require('table.inc');
! 23:
! 24: if (NULL !== ($tmp =@mysqli_real_escape_string($link, "foo", "foo")))
! 25: printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 26:
! 27: if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
! 28: printf("[004] Expecting \\\\, got %s\n", $tmp);
! 29:
! 30: if ('\"' !== ($tmp = mysqli_real_escape_string($link, '"')))
! 31: printf("[005] Expecting \", got %s\n", $tmp);
! 32:
! 33: if ("\'" !== ($tmp = mysqli_real_escape_string($link, "'")))
! 34: printf("[006] Expecting ', got %s\n", $tmp);
! 35:
! 36: if ("\\n" !== ($tmp = mysqli_real_escape_string($link, "\n")))
! 37: printf("[007] Expecting \\n, got %s\n", $tmp);
! 38:
! 39: if ("\\r" !== ($tmp = mysqli_real_escape_string($link, "\r")))
! 40: printf("[008] Expecting \\r, got %s\n", $tmp);
! 41:
! 42: if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
! 43: printf("[009] Expecting %s, got %s\n", "foo\\0bar", $tmp);
! 44:
! 45: mysqli_close($link);
! 46:
! 47: if (NULL !== ($tmp = mysqli_real_escape_string($link, 'foo')))
! 48: printf("[010] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 49:
! 50: /* Make sure that the function alias exists */
! 51: if (NULL !== ($tmp = @mysqli_escape_string()))
! 52: printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 53:
! 54: print "done!";
! 55: ?>
! 56: --EXPECTF--
! 57: Warning: mysqli_real_escape_string(): Couldn't fetch mysqli in %s on line %d
! 58: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>