Skip to content

Convert warning to assetion in MySQL PDO driver #6120

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

Closed
wants to merge 2 commits into from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Sep 12, 2020

I don't see how this can happen, and that seems like a bug if it does.

php_error_docref(NULL, E_WARNING, "Provided PDO instance is not using MySQL but %s", dbh->driver->driver_name);
return NULL;
}
ZEND_ASSERT(dbh->driver == &pdo_mysql_driver);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above !dbh check can be an assertion, but I don't think this one can be. The function accepts a generic zval, so there's no guarantee it uses the mysql driver.

The whole "reverse API" doesn't appear to be actually used inside PHP (looking around, it may be intended for mysqlnd_uh extension). Maybe it can be dropped in the future, but for now I'd leave it alone.

@Girgias Girgias force-pushed the mysql-pdo-warning-to-assert branch from 8215f65 to 6d762b8 Compare September 14, 2020 21:49
@php-pulls php-pulls closed this in 4fc7026 Sep 15, 2020
@Girgias Girgias deleted the mysql-pdo-warning-to-assert branch September 15, 2020 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants