-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ProfilerLogger: Fix errors in DBAL 3.x #69
Conversation
Do not merge, it doesn't work with named arguments, I don't want to make some dirty-fix to check if it's string or integer, and what do to with a case when there are mixed keys, it needs someone who know what is ProfileLogger for and why does parameters need to be filtered. |
So I have checked how SQLParserUtils did it, and I found that there was Only problem with that is, if there will be mixed parameters (mixed = named with positional - ? and :name) and positional will start from 1 and not 0, I have MariaDB and that database doesn't support mixed parameters so I would get error anyway, but maybe proper fix would be looping through $params and checking if there is index 1 and not 0, then decrease all integer indexes by 1, but that would be too much code, especially when I don't even know what is ProfilerLogger for and what exactly is expandListParameters doing, my guess is that it will fill missing $types/$params to equal array size. |
Look at e.g.
I guess the key part that's missing in ProfilerLogger is that with DBAL 3, it should expand the parameters only if the conditions of |
I think it's ready to merge |
@Rixafy would you add a test case for this to make sure this does not break in future DBAL version? |
When persisting and flushing entity, there was an error
So I found that in
ExpandArrayParameters::acceptPositionalParameter
was $index = 0 and first index of$this->originalParameters
started always from 1, not 0Using array_values should resolve the problem, I have tested it on PHP 8.1 and it works just fine.
Also, after resolving the problem there appeared a new one, null value was passed to non-null argument, so I have added a nullcheck.