Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- mysqlnd_ms_set_qos(), GTID SQL parsing - This TEST is useless --SKIPIF-- <?php if..
Decoded Output download
--TEST--
mysqlnd_ms_set_qos(), GTID SQL parsing - This TEST is useless
--SKIPIF--
<?php
if (version_compare(PHP_VERSION, '5.3.99-dev', '<'))
die(sprintf("SKIP Requires PHP >= 5.3.99, using " . PHP_VERSION));
require_once('skipif.inc');
require_once("connect.inc");
if (($emulated_master_host == $emulated_slave_host)) {
die("SKIP master and slave seem to the the same, see tests/README");
}
_skipif_check_extensions(array("mysqli"));
_skipif_connect($emulated_master_host_only, $user, $passwd, $db, $emulated_master_port, $emulated_master_socket);
_skipif_connect($emulated_slave_host_only, $user, $passwd, $db, $emulated_slave_port, $emulated_slave_socket);
include_once("util.inc");
$ret = mst_is_slave_of($emulated_slave_host_only, $emulated_slave_port, $emulated_slave_socket, $emulated_master_host_only, $emulated_master_port, $emulated_master_socket, $user, $passwd, $db);
if (is_string($ret))
die(sprintf("SKIP Failed to check relation of configured master and slave, %s
", $ret));
if (true == $ret)
die("SKIP Configured emulated master and emulated slave could be part of a replication cluster
");
$sql = mst_get_gtid_sql($db);
if ($error = mst_mysqli_setup_gtid_table($emulated_master_host_only, $user, $passwd, $db, $emulated_master_port, $emulated_master_socket))
die(sprintf("SKIP Failed to setup GTID on master, %s
", $error));
if ($error = mst_mysqli_setup_gtid_table($emulated_slave_host_only, $user, $passwd, $db, $emulated_master_port, $emulated_slave_socket))
die(sprintf("SKIP Failed to setup GTID on master, %s
", $error));
$settings = array(
"myapp" => array(
'master' => array(
"master1" => array(
'host' => $emulated_master_host_only,
'port' => (int)$emulated_master_port,
'socket' => $emulated_master_socket,
),
),
'slave' => array(
"slave1" => array(
'host' => $emulated_slave_host_only,
'port' => (int)$emulated_slave_port,
'socket' => $emulated_slave_socket,
),
"slave2" => array(
'host' => $emulated_slave_host_only,
'port' => (int)$emulated_slave_port,
'socket' => $emulated_slave_socket,
),
),
'lazy_connections' => 1,
'global_transaction_id_injection' => array(
'type' => 1,
'on_commit' => $sql['update'],
'fetch_last_gtid' => $sql['fetch_last_gtid'],
'check_for_gtid' => "
'#GTID'",
'report_error' => true,
),
'filters' => array(
"quality_of_service" => array(
"session_consistency" => 1,
),
"roundrobin" => array(),
),
),
);
if ($error = mst_create_config("test_mysqlnd_ms_set_qos_gtid_sql_parsing.ini", $settings))
die(sprintf("SKIP %s
", $error));
?>
--INI--
mysqlnd_ms.enable=1
mysqlnd_ms.config_file=test_mysqlnd_ms_set_qos_gtid_sql_parsing.ini
--FILE--
<?php
require_once("connect.inc");
require_once("util.inc");
$link = mst_mysqli_connect("myapp", $user, $passwd, $db, $port, $socket);
if (mysqli_connect_errno()) {
printf("[001] [%d] %s
", mysqli_connect_errno(), mysqli_connect_error());
}
if (!$link->query("DROP TABLE IF EXISTS test") ||
!$link->query("CREATE TABLE test(id INT)") ||
!$link->query("INSERT INTO test(id) VALUES (1)"))
printf("[002] [%d] %s
", $link->errno, $link->error);
if (false === ($gtid = mysqlnd_ms_get_last_gtid($link)))
printf("[003] [%d] %s
", $link->errno, $link->error);
/* GTID */
if (true !== ($ret = mysqlnd_ms_set_qos($link, MYSQLND_MS_QOS_CONSISTENCY_SESSION, MYSQLND_MS_QOS_OPTION_GTID, $gtid))) {
printf("[004] [%d] %s
", $link->errno, $link->error);
}
if ($res = mst_mysqli_query(6, $link, "SELECT id FROM test"))
var_dump($res->fetch_all());
printf("[007] [%d] '%s'
", $link->errno, $link->error);
print "done!";
?>
--CLEAN--
<?php
if (!unlink("test_mysqlnd_ms_set_qos_gtid_sql_parsing.ini"))
printf("[clean] Cannot unlink ini file 'test_mysqlnd_ms_set_qos_gtid_sql_parsing.ini'.
");
require_once("connect.inc");
require_once("util.inc");
if ($error = mst_mysqli_drop_test_table($emulated_master_host_only, $user, $passwd, $db, $emulated_master_port, $emulated_master_socket))
printf("[clean] %s
", $error);
if ($error = mst_mysqli_drop_gtid_table($emulated_master_host_only, $user, $passwd, $db, $emulated_master_port, $emulated_master_socket))
printf("[clean] %s
", $error);
if ($error = mst_mysqli_drop_gtid_table($emulated_slave_host_only, $user, $passwd, $db, $emulated_slave_port, $emulated_slave_socket))
printf("[clean] %s
", $error);
?>
--EXPECTF--
Warning: mysqli::query(): (mysqlnd_ms) No consistent node found %s
array(1) {
[0]=>
array(1) {
[0]=>
string(1) "1"
}
}
[007] [0] ''
done!
Did this file decode correctly?
Original Code
--TEST--
mysqlnd_ms_set_qos(), GTID SQL parsing - This TEST is useless
--SKIPIF--
<?php
if (version_compare(PHP_VERSION, '5.3.99-dev', '<'))
die(sprintf("SKIP Requires PHP >= 5.3.99, using " . PHP_VERSION));
require_once('skipif.inc');
require_once("connect.inc");
if (($emulated_master_host == $emulated_slave_host)) {
die("SKIP master and slave seem to the the same, see tests/README");
}
_skipif_check_extensions(array("mysqli"));
_skipif_connect($emulated_master_host_only, $user, $passwd, $db, $emulated_master_port, $emulated_master_socket);
_skipif_connect($emulated_slave_host_only, $user, $passwd, $db, $emulated_slave_port, $emulated_slave_socket);
include_once("util.inc");
$ret = mst_is_slave_of($emulated_slave_host_only, $emulated_slave_port, $emulated_slave_socket, $emulated_master_host_only, $emulated_master_port, $emulated_master_socket, $user, $passwd, $db);
if (is_string($ret))
die(sprintf("SKIP Failed to check relation of configured master and slave, %s\n", $ret));
if (true == $ret)
die("SKIP Configured emulated master and emulated slave could be part of a replication cluster\n");
$sql = mst_get_gtid_sql($db);
if ($error = mst_mysqli_setup_gtid_table($emulated_master_host_only, $user, $passwd, $db, $emulated_master_port, $emulated_master_socket))
die(sprintf("SKIP Failed to setup GTID on master, %s\n", $error));
if ($error = mst_mysqli_setup_gtid_table($emulated_slave_host_only, $user, $passwd, $db, $emulated_master_port, $emulated_slave_socket))
die(sprintf("SKIP Failed to setup GTID on master, %s\n", $error));
$settings = array(
"myapp" => array(
'master' => array(
"master1" => array(
'host' => $emulated_master_host_only,
'port' => (int)$emulated_master_port,
'socket' => $emulated_master_socket,
),
),
'slave' => array(
"slave1" => array(
'host' => $emulated_slave_host_only,
'port' => (int)$emulated_slave_port,
'socket' => $emulated_slave_socket,
),
"slave2" => array(
'host' => $emulated_slave_host_only,
'port' => (int)$emulated_slave_port,
'socket' => $emulated_slave_socket,
),
),
'lazy_connections' => 1,
'global_transaction_id_injection' => array(
'type' => 1,
'on_commit' => $sql['update'],
'fetch_last_gtid' => $sql['fetch_last_gtid'],
'check_for_gtid' => "\n'#GTID'",
'report_error' => true,
),
'filters' => array(
"quality_of_service" => array(
"session_consistency" => 1,
),
"roundrobin" => array(),
),
),
);
if ($error = mst_create_config("test_mysqlnd_ms_set_qos_gtid_sql_parsing.ini", $settings))
die(sprintf("SKIP %s\n", $error));
?>
--INI--
mysqlnd_ms.enable=1
mysqlnd_ms.config_file=test_mysqlnd_ms_set_qos_gtid_sql_parsing.ini
--FILE--
<?php
require_once("connect.inc");
require_once("util.inc");
$link = mst_mysqli_connect("myapp", $user, $passwd, $db, $port, $socket);
if (mysqli_connect_errno()) {
printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
}
if (!$link->query("DROP TABLE IF EXISTS test") ||
!$link->query("CREATE TABLE test(id INT)") ||
!$link->query("INSERT INTO test(id) VALUES (1)"))
printf("[002] [%d] %s\n", $link->errno, $link->error);
if (false === ($gtid = mysqlnd_ms_get_last_gtid($link)))
printf("[003] [%d] %s\n", $link->errno, $link->error);
/* GTID */
if (true !== ($ret = mysqlnd_ms_set_qos($link, MYSQLND_MS_QOS_CONSISTENCY_SESSION, MYSQLND_MS_QOS_OPTION_GTID, $gtid))) {
printf("[004] [%d] %s\n", $link->errno, $link->error);
}
if ($res = mst_mysqli_query(6, $link, "SELECT id FROM test"))
var_dump($res->fetch_all());
printf("[007] [%d] '%s'\n", $link->errno, $link->error);
print "done!";
?>
--CLEAN--
<?php
if (!unlink("test_mysqlnd_ms_set_qos_gtid_sql_parsing.ini"))
printf("[clean] Cannot unlink ini file 'test_mysqlnd_ms_set_qos_gtid_sql_parsing.ini'.\n");
require_once("connect.inc");
require_once("util.inc");
if ($error = mst_mysqli_drop_test_table($emulated_master_host_only, $user, $passwd, $db, $emulated_master_port, $emulated_master_socket))
printf("[clean] %s\n", $error);
if ($error = mst_mysqli_drop_gtid_table($emulated_master_host_only, $user, $passwd, $db, $emulated_master_port, $emulated_master_socket))
printf("[clean] %s\n", $error);
if ($error = mst_mysqli_drop_gtid_table($emulated_slave_host_only, $user, $passwd, $db, $emulated_slave_port, $emulated_slave_socket))
printf("[clean] %s\n", $error);
?>
--EXPECTF--
Warning: mysqli::query(): (mysqlnd_ms) No consistent node found %s
array(1) {
[0]=>
array(1) {
[0]=>
string(1) "1"
}
}
[007] [0] ''
done!
Function Calls
None |
Stats
MD5 | 0637220c09b5ddab6a448dfeeb40dc71 |
Eval Count | 0 |
Decode Time | 94 ms |