summaryrefslogtreecommitdiff
path: root/ext/mysql/tests/mysql_escape_string.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mysql/tests/mysql_escape_string.phpt')
-rw-r--r--ext/mysql/tests/mysql_escape_string.phpt33
1 files changed, 33 insertions, 0 deletions
diff --git a/ext/mysql/tests/mysql_escape_string.phpt b/ext/mysql/tests/mysql_escape_string.phpt
new file mode 100644
index 0000000..8e70da6
--- /dev/null
+++ b/ext/mysql/tests/mysql_escape_string.phpt
@@ -0,0 +1,33 @@
+--TEST--
+mysql_escape_string()
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+include "connect.inc";
+
+$tmp = NULL;
+$link = NULL;
+
+if (NULL !== ($tmp = @mysql_escape_string()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+var_dump(@mysql_escape_string("Am I a unicode string in PHP 6?"));
+var_dump(@mysql_escape_string('\\'));
+var_dump(@mysql_escape_string('"'));
+var_dump(@mysql_escape_string("'"));
+var_dump(@mysql_escape_string("\n"));
+var_dump(@mysql_escape_string("\r"));
+var_dump(@mysql_escape_string("foo" . chr(0) . "bar"));
+
+print "done!";
+?>
+--EXPECTF--
+%unicode|string%(31) "Am I a unicode string in PHP 6?"
+%unicode|string%(2) "\\"
+%unicode|string%(2) "\""
+%unicode|string%(2) "\'"
+%unicode|string%(2) "\n"
+%unicode|string%(2) "\r"
+%unicode|string%(8) "foo\0bar"
+done!