From 0c9324ea9ba32e85ccca4f52287d013b0a6ef2a4 Mon Sep 17 00:00:00 2001 From: Matteo Beccati Date: Thu, 15 Dec 2016 09:31:00 +0100 Subject: Skip tests when secure_file_priv dir not writable --- ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt | 11 +++++++++++ ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt | 13 ++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt index ebf22ef61b..38b49b6efa 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt @@ -16,6 +16,17 @@ if (count($tmp) < 2) if (($tmp[1] !== 'localhost') && ($tmp[1] !== '127.0.0.1')) die("skip Test cannot be run against remote database server"); +$stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'"); +if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) { + if (!is_writable($row['value'])) + die("skip secure_file_priv directory not writable: {$row['value']}"); + + $filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv"; + + if (file_exists($filename) && !is_writable($filename)) + die("skip {$filename} not writable"); +} + ?> --FILE-- query("SHOW VARIABLES LIKE 'secure_file_priv'"); +if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) { + if (!is_writable($row['value'])) + die("skip secure_file_priv directory not writable: {$row['value']}"); + + $filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv"; + + if (file_exists($filename) && !is_writable($filename)) + die("skip {$filename} not writable"); +} + ?> --FILE-- %d, 2 => %s, ) -done! \ No newline at end of file +done! -- cgit v1.2.1