{"action":"opened","issue":{"url":"https://api.github.com/repos/wpengine/phpcompat/issues/195","repository_url":"https://api.github.com/repos/wpengine/phpcompat","labels_url":"https://api.github.com/repos/wpengine/phpcompat/issues/195/labels{/name}","comments_url":"https://api.github.com/repos/wpengine/phpcompat/issues/195/comments","events_url":"https://api.github.com/repos/wpengine/phpcompat/issues/195/events","html_url":"https://github.com/wpengine/phpcompat/issues/195","id":351743536,"node_id":"MDU6SXNzdWUzNTE3NDM1MzY=","number":195,"title":"Prevent false positives by ignoring commented lines","user":{"login":"ryanshoover","id":1707424,"node_id":"MDQ6VXNlcjE3MDc0MjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1707424?v=4","gravatar_id":"","url":"https://api.github.com/users/ryanshoover","html_url":"https://github.com/ryanshoover","followers_url":"https://api.github.com/users/ryanshoover/followers","following_url":"https://api.github.com/users/ryanshoover/following{/other_user}","gists_url":"https://api.github.com/users/ryanshoover/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanshoover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanshoover/subscriptions","organizations_url":"https://api.github.com/users/ryanshoover/orgs","repos_url":"https://api.github.com/users/ryanshoover/repos","events_url":"https://api.github.com/users/ryanshoover/events{/privacy}","received_events_url":"https://api.github.com/users/ryanshoover/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-17T21:25:44Z","updated_at":"2018-08-17T21:25:44Z","closed_at":null,"author_association":"NONE","body":"An ongoing \"scary\" issue with the compatibility checker is the false positives from plugins that safely use deprecated code (see the entire whitelist of plugins).\r\n\r\nWe could provide plugin authors with the ability to have this scanner skip over a known-safe line similar to [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-parts-of-a-file)\r\n\r\n```\r\nphpcompat:ignore\r\nphpcompat:disable\r\nphpcompat:enable\r\n```\r\n\r\nExample to fix #184:\r\n\r\n```php\r\nif ( $wpdb->use_mysqli ) {\r\n    $output = mysqli_real_escape_string( $wpdb->dbh, $input );\r\n} else {\r\n    // phpcompat:ignore\r\n    $output = mysql_real_escape_string( $input, $wpdb->dbh );\r\n}\r\n```\r\n\r\nExample to fix #189:\r\n\r\n```php\r\nprotected function get_raw_post_data() {\r\n    // phpcompat:disable\r\n    global $HTTP_RAW_POST_DATA;\r\n\r\n    if ( ! isset( $HTTP_RAW_POST_DATA ) ) {\r\n        $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );\r\n    }\r\n\r\n    return $HTTP_RAW_POST_DATA;\r\n    // phpcompat:enable\r\n}\r\n```"}}
{"actor":{"display_login":"ryanshoover"}}