From 5a328e1dfbd8a790b52fdca8925d2cc77a82316b Mon Sep 17 00:00:00 2001 From: lijialong1313 Date: Mon, 18 Nov 2024 12:14:38 +0800 Subject: [PATCH 1/2] Add a options to fix ignore "expire within" error This error is the same as "the password will expire within" but not ignore. So I write this to let different country use different localized oracle databases can ignore as same as the English version. --- src/Pdo/Oci8.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Pdo/Oci8.php b/src/Pdo/Oci8.php index c7da7d1..811769d 100644 --- a/src/Pdo/Oci8.php +++ b/src/Pdo/Oci8.php @@ -146,7 +146,18 @@ private function connect(string $dsn, string $username, string $password, array if (! $this->dbh) { $e = oci_error(); - if (! str_contains($e['message'], 'the password will expire within')) { + $ignoreMessageList = array_key_exists('ignore_error_messages', $options) ? $options['ignore_error_messages'] : ['the password will expire within']; + + $flag = true; + + foreach ($ignoreMessageList as $str) + { + if (str_contains($e['message'], $str)) { + $flag = false; + } + } + + if ($flag) { throw new Oci8Exception($e['message'], $e['code']); } } From d89924a8fc377ec9eea7833bd6e8a6a29f6affdb Mon Sep 17 00:00:00 2001 From: lijialong1313 Date: Mon, 18 Nov 2024 12:26:29 +0800 Subject: [PATCH 2/2] Update Oci8.php fix format --- src/Pdo/Oci8.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Pdo/Oci8.php b/src/Pdo/Oci8.php index 811769d..5ce6bd4 100644 --- a/src/Pdo/Oci8.php +++ b/src/Pdo/Oci8.php @@ -150,8 +150,7 @@ private function connect(string $dsn, string $username, string $password, array $flag = true; - foreach ($ignoreMessageList as $str) - { + foreach ($ignoreMessageList as $str) { if (str_contains($e['message'], $str)) { $flag = false; }