Skip to content
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

Sniff for using PDO to connect to DB #710

Open
ross-mulcahy opened this issue Mar 1, 2022 · 1 comment
Open

Sniff for using PDO to connect to DB #710

ross-mulcahy opened this issue Mar 1, 2022 · 1 comment

Comments

@ross-mulcahy
Copy link

ross-mulcahy commented Mar 1, 2022

What problem would the enhancement address for VIP?

The PDO_MYSQL module is not enabled on VIP. Plugins reliant on PDO like MailPoet are therefore currently not compatible with VIP.

Describe the solution you'd like

An error should be thrown on an attempt to create a PDO connection.

What code should be reported as a violation?

$db = new PDO();

What code should not be reported as a violation?

Any attempt to use PDO should be reported.

@jrfnl
Copy link
Collaborator

jrfnl commented Mar 1, 2022

The upstream WPCS repo already has a sniff which does this: WordPress.DB.RestrictedClasses: https://github.com/WordPress/WordPress-Coding-Standards/blob/develop/WordPress/Sniffs/DB/RestrictedClassesSniff.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants