Skip to content

Commit 44fa121

Browse files
committed
bug #58523 [DoctrineBridge] fix: DoctrineTokenProvider not oracle compatible (jjjb03)
This PR was merged into the 5.4 branch. Discussion ---------- [DoctrineBridge] fix: DoctrineTokenProvider not oracle compatible | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | see below | License | MIT Problem: Oracle DB returns all not quoted names in uppercase (vs. SQLite for example returns non quoted column names as lowercase) On systems with oracle DB this leads to the Warning/Exception attached below. see also: [PHP Documentation - function.oci-fetch-array- Return Values](https://www.php.net/manual/en/function.oci-fetch-array.php#refsect1-function.oci-fetch-array-returnvalues) ![Screenshot Warning Access to undefined array key](https://github.com/user-attachments/assets/de3dfddd-a46d-472f-9234-ad432d09be6b) <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Commits ------- 119715d fix: DoctrineTokenProvider not oracle compatible
2 parents 5b30bc6 + 119715d commit 44fa121

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy