Closed noniagriconomie closed 4 years ago
I think it's caused by this line https://github.com/doctrine/dbal/commit/21512f9ef5ee1b4acccb553f4b474cd0715ae628#diff-e7dd540cfb86c74ce7361e2bd00053cfR138 from this PR https://github.com/doctrine/dbal/pull/3894
@wuchen90 it seems yes, but as of a patch release, IMO it should not break
Waiting maintainers review/comment, thank you
A stack trace would help I think.
I have a similar issue and can confirm that the patch linked here breaks BC.
Thanks for confirming that. @marcingy @noniagriconomie @wuchen90 , can you please provide a stack trace?
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?
This of help?
Not so much, I think a big part is missing… are you sure there are only 3 lines in your stack trace? How did you obtain it?
This is from phpunit test the rest of the stack is code that is part of my companies application, hence not very useful to you this is the entry point where we call executeQuery.
Ah I guess we are more interested in the stack trace of $ex
here.
Does phpunit only show the top exception? Or are there several of them?
For now, we only know the error message of $ex
, which is 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
, but having its stack trace would be great.
Link to the relevant piece of code: https://github.com/doctrine/dbal/blob/f08343d9ad4cd1d02bf60a171a107e8b03b38f53/lib/Doctrine/DBAL/Driver/PDOStatement.php#L76-L85
Ah I think I have found what the stack trace should look like
And of course, the null
comes from https://github.com/doctrine/dbal/blob/4c03ed81471c62f178581eb325339a3c34f3b71a/lib/Doctrine/DBAL/Connection.php#L901 in executeQuery()
Because of this check: https://github.com/doctrine/dbal/blob/4c03ed81471c62f178581eb325339a3c34f3b71a/lib/Doctrine/DBAL/Connection.php#L1560
So this method must be at fault I think: https://github.com/doctrine/dbal/blob/4c03ed81471c62f178581eb325339a3c34f3b71a/lib/Doctrine/DBAL/Connection.php#L1562
But I don't understand how. A stack trace of the previous exception would really help.
It looks like we go down this path
#1 lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php(241): mysqli_stmt->bind_param(Array, 'VCS_CHANGED_TO_...', 'stargatesg1')
#2 lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php(147): Doctrine\DBAL\Driver\Mysqli\MysqliStatement->bindTypedParameters()
#3 lib/Doctrine/DBAL/Connection.php(906): Doctrine\DBAL\Driver\Mysqli\MysqliStatement->execute()
Looks like I was completely wrong :sweat_smile:
What's also odd, it looks like the line numbers you have do not match perfectly: https://github.com/doctrine/dbal/blob/aab745e7b6b2de3b47019da81e7225e14dcfdac8/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php#L146-L147
Or did you modify the source?
Yes I have modified the source as part of my debuging exercise :(
Makes sense… also, I just noticed that you don't have the same error as OP :sweat:
Can you try
- $types += array_fill_keys(array_keys($params), null);
+ $types += array_fill_keys(array_keys($params), \Doctrine\DBAL\ParameterType::STRING);
in SQLParserUtils and report back?
That didn't make a difference
This method has a really weird API: https://www.php.net/manual/en/mysqli-stmt.bind-param.php
You should dump $types
just before the crash to see what it looks like.
You could also check that it is a string at this line: https://github.com/doctrine/dbal/blob/aab745e7b6b2de3b47019da81e7225e14dcfdac8/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php#L213
And if it is, you should pinpoint the moment at which it no longer is.
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" }
K so it happens in because we loop around the types in _bindTypedValues in connection.php
public function bindValue($param, $value, $type = ParameterType::STRING)
After some digging it turns out it was actually a bug in our code which was hidden.
- $sql = "UPDATE site SET vcs_path = '?' WHERE sitegroup = '?'";
+ $sql = "UPDATE site SET vcs_path = ? WHERE sitegroup = ?";
So extra quotes, sorry about that but I wonder if that might be underlying issue for the original bug
hi @greg0ire sorry i was mainly AFK this month
what kind of stacktrace do you need, if i dump you the sf log is it usefull? I can reproduce it if you want
if i dump you the sf log is it usefull?
I don't need the full log of the request, just the stack trace that corresponds to the innermost exception you are getting. See the stack trace tab on this image? Click it and copy the stack trace as text.
@marcingy the patch above made your issue more visible I think, I'm not sure how. Anyway, I marked your messages as resolved so that we can more easily focus on OP's issue.
@greg0ire here you are
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
[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
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.
Will have a look later, but it looks helpful, thanks!
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?
Ok sure i will try on monday and report here
Also, you motivated me to contribute this: https://github.com/symfony/symfony-docs/pull/13699 :slightly_smiling_face:
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
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
BC Break Report
Hello, here is my bug report, after upgrading locally
doctrine/dbal
fromv2.10.1
tov2.10.2
(patch upgrade
)Summary
Previous behaviour
Working (yes i know not the best way to write prepared query with
?
param, but not the point here :s ))Current behavior
How to reproduce
More info
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