-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix Issue with system query in php8 #251
Fix Issue with system query in php8 #251
Conversation
I'm not clear on why this bug is showing up just with php8, or why it seems like it's just a BD issue. So the parameters are passed even after the tokens have been replaced, after which there are no more tokens in the string? I'm trying to understand this better. That seems like a potentially broad issue, so I'm curious as to if it's also shown up for Drupal sites. |
@herbdool I too am a bit confused I don't know if I am missing something here but maybe something with the changes brought across from D7 is triggering something. In regards to why not for other drupal sites well it is only d6 and backdrop that get into this part of the dbtng https://github.com/drush-ops/drush/blob/8.x/includes/dbtng.inc#L105 as the If on L81 there will capture D7,D8,D9 and they don't trigger the _drush_replace_query_placeholders function |
Just verbalizing the error message for clarity - the SQL expression doesn't have any variables/tokens. The error seems to be saying: "You asked me to interpolate some variables, but they've already been interpolated!" That is a smelly circumstance - I could imagine that php8's PDO might be stricter than php7's PDO?
Is that just happenstance of the numbering (ie Backdrop 1.x is numerically less than Drupal 7.x)? Or is there a real difference in the API support? It feels like maybe the branch/API-detection should have a way to say: "Yes, this first code-branch works fine on Backdrop"?
So if L111 has already interpolated - return db_query($query, $args);
+ return db_query($query);
Right, but we don't know where it ends, do we? It looks like this is structural problem in drush's query function that would affect other use-cases? |
Ah, hrm... if you have any variables in other parts of the query, then L111 won't address those. Maybe it should be more like this? L111
- $where = _drush_replace_query_placeholders($where, $args);
L131
- db_query($query, $args);
+ db_query(_drush_replace_query_placeholders($query, $args)); Or... if |
With only two calls to |
We (CiviCRM) have been testing out php8 on our CI infrastructure and using a development version of drush8 and have found that we get the following error when trying to do a drush user-create command
This resolves it by avoiding the use of parameters as they get replaced https://github.com/drush-ops/drush/blob/8.x/includes/dbtng.inc#L111 but then still passed to db_query https://github.com/drush-ops/drush/blob/8.x/includes/dbtng.inc#L131 and it seemed easier to patch the backdrop integration than drush
ping @herbdool @totten