cakephp / cakephp/phinx

Fails if supplied PDO has default mode set FETCH_ASSOC

Open
#1,552 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
4.5k
Forks
884
PR merge metrics
No merged PRs in 30d

Description

Obvious work around - dont supply pdo connection with PDO::FETCH_ASSOC set as default. But... it could be a little more resilient.

trips over:

SQLiteAdapter.php -- public function hasTable($tableName)
   ...
        $rows = $this->fetchAll(sprintf('SELECT name FROM sqlite_master WHERE ...
        foreach ($rows as $row) {
            $tables[] = strtolower($row[0]); <<<< oops
        }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with SQLiteAdapter.php, specifically public function hasTable($tableName), and inspect how fetchAll handles the supplied PDO fetch mode. Reproduce the failure with PDO::FETCH_ASSOC; done when hasTable works with that default mode instead of failing while reading the returned rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, sqlite
Domain
database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.