8000 fix: DoctrineTokenProvider not oracle compatible · symfony/symfony@119715d · GitHub
[go: up one dir, main page]

Skip to content

Commit 119715d

Browse files
jjjb03Johannes Boost
authored and
Johannes Boost
committed
fix: DoctrineTokenProvider not oracle compatible
Oracle converts all not quoted names to uppercase
1 parent cc3fb70 commit 119715d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,17 @@ public function __construct(Connection $conn)
5555
*/
5656
public function loadTokenBySeries(string $series)
5757
{
58-
// the alias for lastUsed works around case insensitivity in PostgreSQL
59-
$sql = 'SELECT class, username, value, lastUsed AS last_used FROM rememberme_token WHERE series=:series';
58+
$sql = 'SELECT class, username, value, lastUsed FROM rememberme_token WHERE series=:series';
6059
$paramValues = ['series' => $series];
6160
$paramTypes = ['series' => ParameterType::STRING];
6261
$stmt = $this->conn->executeQuery($sql, $paramValues, $paramTypes);
63-
$row = $stmt instanceof Result || $stmt instanceof DriverResult ? $stmt->fetchAssociative() : $stmt->fetch(\PDO::FETCH_ASSOC);
62+
63+
// fetching numeric because column name casing depends on platform, eg. Oracle converts all not quoted names to uppercase
64+
$row = $stmt instanceof Result || $stmt instanceof DriverResult ? $stmt->fetchNumeric() : $stmt->fetch(\PDO::FETCH_NUM);
6465

6566
if ($row) {
66-
return new PersistentToken($row['class'], $row['username'], $series, $row['value'], new \DateTime($row['last_used']));
67+
[$class, $username, $value, $last_used] = $row;
68+
return new PersistentToken($class, $username, $series, $value, new \DateTime($last_used));
6769
}
6870

6971
throw new TokenNotFoundException('No token found.');

0 commit comments

Comments
 (0)
0