Skip to content

Commit

Permalink
setAttribute PDO::ATTR_STRINGIFY_FETCHES, true
Browse files Browse the repository at this point in the history
in php <= 8 id is a string, in php >= 8.1 it is a int
https://github.com/php/php-src/blob/PHP-8.1/UPGRADING#L131
  • Loading branch information
koriym committed Nov 14, 2021
1 parent 291e682 commit a5c0791
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/Iso8601FormatModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Aura\Sql\ExtendedPdo;
use Aura\Sql\ExtendedPdoInterface;
use PDO;
use PHPUnit\Framework\TestCase;
use Ray\Di\AbstractModule;
use Ray\Di\Injector;
Expand All @@ -21,6 +22,7 @@ class Iso8601FormatModuleTest extends TestCase
protected function setUp(): void
{
$pdo = new ExtendedPdo('sqlite::memory:');
$pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
$pdo->query('CREATE TABLE IF NOT EXISTS todo (
id INTEGER,
title TEXT,
Expand Down
3 changes: 3 additions & 0 deletions tests/SqlQueryModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class SqlQueryModuleTest extends TestCase
protected function setUp(): void
{
$pdo = new ExtendedPdo('sqlite::memory:');
$pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
$pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
$pdo->query('CREATE TABLE IF NOT EXISTS todo (
id INTEGER,
title TEXT
Expand Down Expand Up @@ -168,6 +170,7 @@ public function testResourceObject404(): void
public function testDevSqlModule(): void
{
$pdo = new ExtendedPdo('sqlite::memory:');
$pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
$pdo->query('CREATE TABLE IF NOT EXISTS todo (
id INTEGER,
title TEXT
Expand Down
1 change: 1 addition & 0 deletions tests/SqlQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class SqlQueryTest extends TestCase
protected function setUp(): void
{
$pdo = new ExtendedPdo('sqlite::memory:');
$pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
$pdo->query('CREATE TABLE IF NOT EXISTS todo (
id INTEGER,
title TEXT
Expand Down

0 comments on commit a5c0791

Please sign in to comment.