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