Skip to content

Commit 99de97f

Browse files
committed
fix: regex pattern for Easy Connect string
1 parent 5bd4d4c commit 99de97f

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

system/Database/OCI8/Connection.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,22 @@ 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+
([a-z0-9.$_]+)? # Service name
67+
(:[a-z]+)? # Server type
68+
(\/[a-z0-9$_]+)? # Instance name
69+
$/ix',
70+
// Instance name (defined in tnsnames.ora)
71+
'in' => '/^[a-z0-9$_]+$/i',
6072
];
6173

6274
/**

0 commit comments

Comments
 (0)