Schema not loading with `PDO::ATTR_STRINGIFY_FETCHES => true`
Open
Nobody has claimed this yet.
type:bug
- Dominant language
- PHP
- Stars
- 41
- Forks
- 17
- Avg merge
- 1h 2m
- Merged PRs (30d)
- 1
Description
$dsn = (new Dsn('pgsql', '127.0.0.1'))->asString();
$pdoDriver = new Driver($dsn, 'postgres', '', [\PDO::ATTR_STRINGIFY_FETCHES => true]);
$schemaCache = new SchemaCache(new FileCache(__DIR__ . '/runtime/cache'));
$db = new Connection($pdoDriver, $schemaCache);
$schema = $db->getSchema();
$tableSchema = $schema->getTableSchema('table_name', true);
The result is
TypeError: Yiisoft\Db\Schema\AbstractColumnSchema::allowNull(): Argument #1 ($value) must be of type bool, string given, called in ...\db-pgsql\src\Schema.php on line 775
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction in the issue and inspect yiisoft/db-pgsql/src/Schema.php around line 775, where the TypeError occurs while loading the table schema. Trace the value passed to AbstractColumnSchema::allowNull() when PDO::ATTR_STRINGIFY_FETCHES is enabled; done means getSchema()->getTableSchema() loads successfully with that option.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100