-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-8.4: Fix GH-16131: Prevent mixing PDO sub-classes with different DSN
- Loading branch information
Showing
5 changed files
with
84 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--TEST-- | ||
Test calling a PDO sub-class constructor with a different DSN | ||
--EXTENSIONS-- | ||
pdo_pgsql | ||
pdo_sqlite | ||
--FILE-- | ||
<?php | ||
|
||
try { | ||
new Pdo\Pgsql('sqlite::memory:'); | ||
} catch (PDOException $e) { | ||
echo $e->getMessage() . "\n"; | ||
} | ||
|
||
class MyPgsql extends Pdo\Pgsql | ||
{ | ||
} | ||
|
||
try { | ||
new MyPgsql('sqlite::memory:'); | ||
} catch (PDOException $e) { | ||
echo $e->getMessage() . "\n"; | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
Pdo\Pgsql::__construct() cannot be used for connecting to the "sqlite" driver, either call Pdo\Sqlite::__construct() or PDO::__construct() instead | ||
MyPgsql::__construct() cannot be used for connecting to the "sqlite" driver, either call Pdo\Sqlite::__construct() or PDO::__construct() instead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters