Skip to content

Commit 2eb1d29

Browse files
committed
Test driver subclasses on 8.4+
1 parent 78bcc57 commit 2eb1d29

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/fvt.inc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ abstract class FVTTest
3939
public function connect($autoCommit=true, $useLibl=false, $useIsolation=false)
4040
{
4141
$options = array(PDO::ATTR_AUTOCOMMIT=>$autoCommit);
42-
$this->db = new PDO($this->dsn, $this->user, $this->pass, $options);
42+
// Use the driver subclass on PHP 8.4+
43+
$this->db = version_compare(PHP_VERSION, '8.4.0') >= 0
44+
? PDO::construct($this->dsn, $this->user, $this->pass, $options)
45+
: new PDO($this->dsn, $this->user, $this->pass, $options);
4346
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
4447
$this->db->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER);
4548
$this->db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);

0 commit comments

Comments
 (0)