Skip to content

Commit 6c61938

Browse files
committed
fix: regex pattern for Easy Connect string
1 parent 8c603af commit 6c61938

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

system/Database/OCI8/Connection.php

+18-4
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,24 @@ class Connection extends BaseConnection
5353
];
5454

5555
protected $validDSNs = [
56-
'tns' => '/^\(DESCRIPTION=(\(.+\)){2,}\)$/', // TNS
57-
// Easy Connect string (Oracle 10g+)
58-
'ec' => '/^(\/\/)?[a-z0-9.:_-]+(:[1-9][0-9]{0,4})?(\/[a-z0-9$_]+)?(:[^\/])?(\/[a-z0-9$_]+)?$/i',
59-
'in' => '/^[a-z0-9$_]+$/i', // Instance name (defined in tnsnames.ora)
56+
// TNS
57+
'tns' => '/^\(DESCRIPTION=(\(.+\)){2,}\)$/',
58+
// Easy Connect string (Oracle 10g+).
59+
// https://docs.oracle.com/en/database/oracle/oracle-database/23/netag/configuring-naming-methods.html#GUID-36F3A17D-843C-490A-8A23-FB0FE005F8E8
60+
// [//]host[:port][/[service_name][:server_type][/instance_name]]
61+
'ec' => '/^
62+
(\/\/)?
63+
(\[)?[a-z0-9.:_-]+(\])? # Host or IP address
64+
(:[1-9][0-9]{0,4})? # Port
65+
(
66+
(\/)
67+
([a-z0-9.$_]+)? # Service name
68+
(:[a-z]+)? # Server type
69+
(\/[a-z0-9$_]+)? # Instance name
70+
)?
71+
$/ix',
72+
// Instance name (defined in tnsnames.ora)
73+
'in' => '/^[a-z0-9$_]+$/i',
6074
];
6175

6276
/**

0 commit comments

Comments
 (0)