Annotation of embedaddon/php/ext/mysql/tests/mysql_real_escape_string.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mysql_real_escape_string()
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: require_once('skipifconnectfailure.inc');
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10: include "connect.inc";
! 11:
! 12: $tmp = NULL;
! 13: $link = NULL;
! 14:
! 15: if (NULL !== ($tmp = @mysql_real_escape_string()))
! 16: printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 17:
! 18: require('table.inc');
! 19:
! 20: if (NULL !== ($tmp = @mysql_real_escape_string('foo', $link, $link)))
! 21: printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
! 22:
! 23: var_dump(mysql_real_escape_string("Am I a unicode string in PHP 6?", $link));
! 24: var_dump(mysql_real_escape_string('\\', $link));
! 25: var_dump(mysql_real_escape_string('"', $link));
! 26: var_dump(mysql_real_escape_string("'", $link));
! 27: var_dump(mysql_real_escape_string("\n", $link));
! 28: var_dump(mysql_real_escape_string("\r", $link));
! 29: var_dump($tmp = mysql_real_escape_string("foo" . chr(0) . "bar", $link));
! 30:
! 31: assert($tmp === mysql_real_escape_string("foo" . chr(0) . "bar"));
! 32:
! 33: print "done!";
! 34: ?>
! 35: --EXPECTF--
! 36: %unicode|string%(31) "Am I a unicode string in PHP 6?"
! 37: %unicode|string%(2) "\\"
! 38: %unicode|string%(2) "\""
! 39: %unicode|string%(2) "\'"
! 40: %unicode|string%(2) "\n"
! 41: %unicode|string%(2) "\r"
! 42: %unicode|string%(8) "foo\0bar"
! 43: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>