dbal: [BC Break] 2.10.1 to v2.10.2: PDOStatement::convertParamType() must be of the type int, null given

BC Break Report

Hello, here is my bug report, after upgrading locally doctrine/dbal from v2.10.1 to v2.10.2 (patch upgrade)

Q A
BC Break yes
Version 2.10.2

Summary

$countryCode = $conn->executeQuery(
    'SELECT country_code FROM core_town WHERE id = ?;',
    [$townId]
)->fetchColumn(0);

info:
int $townId
$conn is $conn = $this->_em->getConnection();
code lives inside a class extending Doctrine\ORM\EntityRepository
  • ✅ works on 2.10.1
  • ❌ fatal on 2.10.2

Previous behaviour

Working (yes i know not the best way to write prepared query with ? param, but not the point here 😒 ))

Current behavior

An exception occurred while executing 'SELECT country_code FROM core_town WHERE id = ?;' with params [36548]:

Argument 1 passed to Doctrine\DBAL\Driver\PDOStatement::convertParamType() must be of the type int, null given, called in /Users/antoine/Sites/api/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 78

How to reproduce

More info</summary

Symfony 4.3.latest PHP 7.3.17

while doing:

composer upgrade doctrine/dbal

other doctrine component updated are


  - Updating doctrine/annotations (v1.8.0 => 1.10.2): Loading from cache
  - Updating doctrine/reflection (v1.1.0 => 1.2.1): Loading from cache
  - Updating doctrine/persistence (1.3.6 => 1.3.7): Loading from cache
  - Updating doctrine/orm (v2.7.0 => v2.7.2): Loading from cache

I’ve checked the doc, this part https://www.doctrine-project.org/projects/doctrine-dbal/en/2.10/reference/data-retrieval-and-manipulation.html#doctrine-dbal-types-conversion but my issue is more on the bc breack more than the doc and code rewrite

</detaisl>

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 34 (17 by maintainers)

Most upvoted comments

I will review it carefuly 😃

edit:

I noticed that there are calls to auxmoney/opentracing-bundle-doctrine-dbal right in the middle of the stack trace. You could try disabling it to see if maybe that’s causing the bug?

@greg0ire indeed, when disabling the bundle, code works fine I need to investigate more here (link with the patch release and the other lib) anyway, thank you for your time here

i will open an issue to the other repo soon, pointing to this one cc @wuchen90

Closing in favor of the issue mentioned above, thanks

Ok sure i will try on monday and report here

Your first message contains 2 exceptions, but not the stack trace, so it doesn’t really help. When in cli, use bin/console -vvv and then you will have stack trace. The second message (http context) contains just 1 out of 2 exception (see the [2/2] ?). I think exception [1/2] might be more interesting, please include it.

@greg0ire here you are

CLI

 16:30:09 CRITICAL  [app] Uncaught console command exception
[
  "class" => "Doctrine\DBAL\DBALException",
  "message" => """
    An exception occurred while executing 'UPDATE front_slider SET path = ? WHERE src = ?' with params ["5a\/50\/48879ffc0348a4589476d5a1ea7d.jpeg", "slider_5c49eeeee418a.jpeg"]:\n
    \n
    Argument 1 passed to Doctrine\DBAL\Driver\PDOStatement::convertParamType() must be of the type int, null given, called in /Users/antoine/Sites/front/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 78
    """,
  "file" => "/Users/antoine/Sites/front/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php",
  "line" => 172,
  "command" => "doctrine:migrations:migrate",
  "input" => "'doc:m:m' --no-interaction --allow-no-migration --em=front -vvv"
]
[
  "uid" => "9c8d9110a7"
]

In DBALException.php line 172:
                                                                                                                  
  [Doctrine\DBAL\DBALException]                                                                                   
  An exception occurred while executing 'UPDATE front_slider SET path = ? WHERE src = ?' with params ["5a\/50\/4  
  8879ffc0348a4589476d5a1ea7d.jpeg", "slider_5c49eeeee418a.jpeg"]:                                                
                                                                                                                  
  Argument 1 passed to Doctrine\DBAL\Driver\PDOStatement::convertParamType() must be of the type int, null given  
  , called in /Users/antoine/Sites/front/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line   
  78                                                                                                              
                                                                                                                  

Exception trace:
  at /Users/antoine/Sites/front/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:172
 Doctrine\DBAL\DBALException::wrapException() at /Users/antoine/Sites/front/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:149
 Doctrine\DBAL\DBALException::driverExceptionDuringQuery() at /Users/antoine/Sites/front/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:914
 Doctrine\DBAL\Connection->executeQuery() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/Executor.php:349
 Doctrine\Migrations\Version\Executor->executeVersionExecutionResult() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/Executor.php:216
 Doctrine\Migrations\Version\Executor->executeMigration() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/Executor.php:128
 Doctrine\Migrations\Version\Executor->execute() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/Version.php:181
 Doctrine\Migrations\Version\Version->execute() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Migrator.php:180
 Doctrine\Migrations\Migrator->executeMigration() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Migrator.php:146
 Doctrine\Migrations\Migrator->migrate() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php:164
 Doctrine\Migrations\Tools\Console\Command\MigrateCommand->execute() at /Users/antoine/Sites/front/vendor/doctrine/doctrine-migrations-bundle/Command/MigrationsMigrateDoctrineCommand.php:56
 Doctrine\Bundle\MigrationsBundle\Command\MigrationsMigrateDoctrineCommand->execute() at /Users/antoine/Sites/front/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /Users/antoine/Sites/front/vendor/symfony/console/Application.php:1005
 Symfony\Component\Console\Application->doRunCommand() at /Users/antoine/Sites/front/vendor/symfony/framework-bundle/Console/Application.php:86
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /Users/antoine/Sites/front/vendor/symfony/console/Application.php:255
 Symfony\Component\Console\Application->doRun() at /Users/antoine/Sites/front/vendor/symfony/framework-bundle/Console/Application.php:74
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Users/antoine/Sites/front/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /Users/antoine/Sites/front/bin/console:42

In PDOStatement.php line 199:
                                                                                                                  
  [TypeError]                                                                                                     
  Argument 1 passed to Doctrine\DBAL\Driver\PDOStatement::convertParamType() must be of the type int, null given  
  , called in /Users/antoine/Sites/front/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line   
  78                                                                                                              
                                                                                                                  

Exception trace:
  at /Users/antoine/Sites/front/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:199
 Doctrine\DBAL\Driver\PDOStatement->convertParamType() at /Users/antoine/Sites/front/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:78
 Doctrine\DBAL\Driver\PDOStatement->bindValue() at /Users/antoine/Sites/front/vendor/auxmoney/opentracing-bundle-doctrine-dbal/DBAL/TracingStatement.php:103
 Auxmoney\OpentracingDoctrineDBALBundle\DBAL\TracingStatement->bindValue() at /Users/antoine/Sites/front/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1556
 Doctrine\DBAL\Connection->_bindTypedValues() at /Users/antoine/Sites/front/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:905
 Doctrine\DBAL\Connection->executeQuery() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/Executor.php:349
 Doctrine\Migrations\Version\Executor->executeVersionExecutionResult() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/Executor.php:216
 Doctrine\Migrations\Version\Executor->executeMigration() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/Executor.php:128
 Doctrine\Migrations\Version\Executor->execute() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/Version.php:181
 Doctrine\Migrations\Version\Version->execute() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Migrator.php:180
 Doctrine\Migrations\Migrator->executeMigration() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Migrator.php:146
 Doctrine\Migrations\Migrator->migrate() at /Users/antoine/Sites/front/vendor/doctrine/migrations/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php:164
 Doctrine\Migrations\Tools\Console\Command\MigrateCommand->execute() at /Users/antoine/Sites/front/vendor/doctrine/doctrine-migrations-bundle/Command/MigrationsMigrateDoctrineCommand.php:56
 Doctrine\Bundle\MigrationsBundle\Command\MigrationsMigrateDoctrineCommand->execute() at /Users/antoine/Sites/front/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /Users/antoine/Sites/front/vendor/symfony/console/Application.php:1005
 Symfony\Component\Console\Application->doRunCommand() at /Users/antoine/Sites/front/vendor/symfony/framework-bundle/Console/Application.php:86
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /Users/antoine/Sites/front/vendor/symfony/console/Application.php:255
 Symfony\Component\Console\Application->doRun() at /Users/antoine/Sites/front/vendor/symfony/framework-bundle/Console/Application.php:74
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Users/antoine/Sites/front/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /Users/antoine/Sites/front/bin/console:42

doctrine:migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--configuration [CONFIGURATION]] [--db-configuration [DB-CONFIGURATION]] [--db DB] [--em EM] [--shard SHARD] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<version>]

exit status 1

WEB

[1/2] FatalThrowableError
Symfony\Component\Debug\Exception\FatalThrowableError:
Type error: Argument 1 passed to Doctrine\DBAL\Driver\PDOStatement::convertParamType() must be of the type int, null given, called in /Users/antoine/Sites/admin/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 78

  at /Users/antoine/Sites/admin/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:199
  at Doctrine\DBAL\Driver\PDOStatement->convertParamType(null)
     (/Users/antoine/Sites/admin/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:78)
  at Doctrine\DBAL\Driver\PDOStatement->bindValue(1, 12312, null)
     (/Users/antoine/Sites/admin/vendor/auxmoney/opentracing-bundle-doctrine-dbal/DBAL/TracingStatement.php:103)
  at Auxmoney\OpentracingDoctrineDBALBundle\DBAL\TracingStatement->bindValue(1, 12312)
     (/Users/antoine/Sites/admin/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1556)
  at Doctrine\DBAL\Connection->_bindTypedValues(object(TracingStatement), array(12312), array(null))
     (/Users/antoine/Sites/admin/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:905)
  at Doctrine\DBAL\Connection->executeQuery('SELECT country_code FROM core_town WHERE id = ?;', array(12312))
     (AdminBundle/Controller/ContactController.php:39)
  at AdminBundle\Controller\ContactController->indexAction(object(Request), 1)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:200)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request), 1, true)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/SubRequestHandler.php:102)
  at Symfony\Component\HttpKernel\HttpCache\SubRequestHandler::handle(object(Kernel), object(Request), 1, true)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php:453)
  at Symfony\Component\HttpKernel\HttpCache\HttpCache->forward(object(Request), true, null)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php:64)
  at Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache->forward(object(Request), true)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php:426)
  at Symfony\Component\HttpKernel\HttpCache\HttpCache->fetch(object(Request), true)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php:317)
  at Symfony\Component\HttpKernel\HttpCache\HttpCache->lookup(object(Request), true)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php:192)
  at Symfony\Component\HttpKernel\HttpCache\HttpCache->handle(object(Request))
     (/Users/antoine/Sites/admin/web/index.php:41)


[2/2] DBALException
Doctrine\DBAL\DBALException:
An exception occurred while executing 'SELECT country_code FROM core_town WHERE id = ?;' with params [12312]:

Argument 1 passed to Doctrine\DBAL\Driver\PDOStatement::convertParamType() must be of the type int, null given, called in /Users/antoine/Sites/admin/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 78

  at /Users/antoine/Sites/admin/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:172
  at Doctrine\DBAL\DBALException::wrapException(object(Driver), object(TypeError), 'An exception occurred while executing \'SELECT country_code FROM core_town WHERE id = ?;\' with params [12312]:Argument 1 passed to Doctrine\\DBAL\\Driver\\PDOStatement::convertParamType() must be of the type int, null given, called in /Users/antoine/Sites/admin/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 78')
     (/Users/antoine/Sites/admin/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:149)
  at Doctrine\DBAL\DBALException::driverExceptionDuringQuery(object(Driver), object(TypeError), 'SELECT country_code FROM core_town WHERE id = ?;', array(12312))
     (/Users/antoine/Sites/admin/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:914)
  at Doctrine\DBAL\Connection->executeQuery('SELECT country_code FROM core_town WHERE id = ?;', array(12312))
     (AdminBundle/Controller/ContactController.php:39)
  at AdminBundle\Controller\ContactController->indexAction(object(Request), 1)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:200)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request), 1, true)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/SubRequestHandler.php:102)
  at Symfony\Component\HttpKernel\HttpCache\SubRequestHandler::handle(object(Kernel), object(Request), 1, true)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php:453)
  at Symfony\Component\HttpKernel\HttpCache\HttpCache->forward(object(Request), true, null)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php:64)
  at Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache->forward(object(Request), true)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php:426)
  at Symfony\Component\HttpKernel\HttpCache\HttpCache->fetch(object(Request), true)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php:317)
  at Symfony\Component\HttpKernel\HttpCache\HttpCache->lookup(object(Request), true)
     (/Users/antoine/Sites/admin/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php:192)
  at Symfony\Component\HttpKernel\HttpCache\HttpCache->handle(object(Request))
     (/Users/antoine/Sites/admin/web/index.php:41)

                                

friendly ping @greg0ire here are both stack traces, thank you for your time

It is an array when we get into this method, will trace further back

/Users/marc.ingram/checkouts/hosting-api/docroot/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php:215: array(2) { [0] => string(1) "s" [1] => string(1) "s" }

Doctrine\DBAL\DBALException: An exception occurred while executing 'UPDATE site SET vcs_path = '?' WHERE sitegroup = '?'' with params ["VCS_CHANGED_TO_PATH_UNKNOWN", "stargatesg1"]:

mysqli_stmt::bind_param() expects parameter 1 to be string, array given

/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:172
/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:149
/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:914

This of help?