mirror of
https://github.com/php/php-src.git
synced 2024-10-02 07:16:11 +00:00
b7091aaf01
Per https://wiki.php.net/rfc/mysql_deprecation, connecting to a MySQL database via ext/mysql now generates an E_DEPRECATED error. This commit includes the minimal EXPECTF updates required for the test suite to pass: it may be preferable to refactor some of the tests to suppress deprecation errors in situations where no other error is expected from mysql_[p]connect(), but I'm not enough of a MySQL expert to want to get my hands that dirty in a long standing test suite.
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
--TEST--
|
|
mysql_real_escape_string()
|
|
--SKIPIF--
|
|
<?php
|
|
require_once('skipif.inc');
|
|
require_once('skipifconnectfailure.inc');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
include "connect.inc";
|
|
|
|
$tmp = NULL;
|
|
$link = NULL;
|
|
|
|
if (NULL !== ($tmp = @mysql_real_escape_string()))
|
|
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
|
|
|
require('table.inc');
|
|
|
|
if (NULL !== ($tmp = @mysql_real_escape_string('foo', $link, $link)))
|
|
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
|
|
|
|
var_dump(mysql_real_escape_string("Am I a unicode string in PHP 6?", $link));
|
|
var_dump(mysql_real_escape_string('\\', $link));
|
|
var_dump(mysql_real_escape_string('"', $link));
|
|
var_dump(mysql_real_escape_string("'", $link));
|
|
var_dump(mysql_real_escape_string("\n", $link));
|
|
var_dump(mysql_real_escape_string("\r", $link));
|
|
var_dump($tmp = mysql_real_escape_string("foo" . chr(0) . "bar", $link));
|
|
|
|
assert($tmp === mysql_real_escape_string("foo" . chr(0) . "bar"));
|
|
|
|
print "done!";
|
|
?>
|
|
--EXPECTF--
|
|
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
|
|
%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!
|