mysql_escape_string.phpt 824 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. mysql_escape_string()
  3. --SKIPIF--
  4. <?php require_once('skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. include "connect.inc";
  8. $tmp = NULL;
  9. $link = NULL;
  10. if (NULL !== ($tmp = @mysql_escape_string()))
  11. printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  12. var_dump(@mysql_escape_string("Am I a unicode string in PHP 6?"));
  13. var_dump(@mysql_escape_string('\\'));
  14. var_dump(@mysql_escape_string('"'));
  15. var_dump(@mysql_escape_string("'"));
  16. var_dump(@mysql_escape_string("\n"));
  17. var_dump(@mysql_escape_string("\r"));
  18. var_dump(@mysql_escape_string("foo" . chr(0) . "bar"));
  19. print "done!";
  20. ?>
  21. --EXPECTF--
  22. %unicode|string%(31) "Am I a unicode string in PHP 6?"
  23. %unicode|string%(2) "\\"
  24. %unicode|string%(2) "\""
  25. %unicode|string%(2) "\'"
  26. %unicode|string%(2) "\n"
  27. %unicode|string%(2) "\r"
  28. %unicode|string%(8) "foo\0bar"
  29. done!