File tree 1 file changed +11
-8
lines changed
1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -11,14 +11,17 @@ PDOTest::skip();
11
11
<?php
12
12
require __DIR__ . '/config.inc ' ;
13
13
14
- [
15
- 'ENV ' => [
16
- 'PDOTEST_DSN ' => $ dsnWithCredentials ,
17
- 'PDOTEST_USER ' => $ user ,
18
- 'PDOTEST_PASS ' => $ password ,
19
- ],
20
- ] = __DIR__ . '/common.phpt ' ;
21
-
14
+ $ dsnWithCredentials = $ config ['ENV ' ]['PDOTEST_DSN ' ];
15
+ $ user = $ config ['ENV ' ]['PDOTEST_USER ' ] ?? null ;
16
+ $ password = $ config ['ENV ' ]['PDOTEST_PASS ' ] ?? null ;
17
+ if (!$ user ) {
18
+ preg_match ('/user=(.*?) / ' , $ dsnWithCredentials , $ match );
19
+ $ user = $ match [1 ] ?? '' ;
20
+ }
21
+ if (!$ password ) {
22
+ preg_match ('/password=(.*?) / ' , $ dsnWithCredentials , $ match );
23
+ $ password = $ match [1 ] ?? '' ;
24
+ }
22
25
$ dsn = str_replace (" user= {$ user } password= {$ password }" , '' , $ dsnWithCredentials );
23
26
24
27
echo "dsn without credentials / correct user / correct password \n" ;
You can’t perform that action at this time.
0 commit comments