-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
Modularizing the discouraged functions #633
Modularizing the discouraged functions #633
Conversation
* @author Shady Sharaf <shady@x-team.com> | ||
* @author Ulrich Pogson <ulrich@pogson.ch> | ||
*/ | ||
class WordPress_Sniffs_PHP_DeprecatedFunctionsSniff extends WordPress_AbstractFunctionRestrictionsSniff { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: This whole file can be removed as this is covered in #608.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I will rebase once it is merged.
2921735
to
0d6ca0b
Compare
As I am going through DiscouragedFunctionsSniff I see a check for |
4d753f5
to
0682c3c
Compare
A quick update. I have separated the different functions. Currently Deprecated function are not done yet. Waiting for a response from #576 (comment) Travis is failing becuase of another issue. My unit tests are passing. This list of functions is still in 'runtime_configuration' => array(
'type' => 'error',
'message' => '%s is prohibited, changing configuration at runtime is not allowed on VIP Production.',
'functions' => array(
'dl',
'error_reporting',
'ini_alter',
'ini_restore',
'ini_set',
'magic_quotes_runtime',
'set_magic_quotes_runtime',
'apache_setenv',
'putenv',
'set_include_path',
'restore_include_path',
),
), We also have a list of functions that are blocked by the theme review team that we could maybe add to the same sniff. https://github.com/WPTRT/WordPress-Coding-Standards/pull/10/files#diff-75f603ed5bb071632d90df9854203926R29 Would love some feedback! 😄 |
RE |
So |
As the |
The check is already included in PHPCompatibility DeprecatedIniDirectivesSniff.php What do you think of including the TRT restricted PHP functions in the PHP folder? |
The PHPCompatibility sniffs are a separate ruleset which does not get shipped with WPCS, so unless people add that to their custom ruleset, they won't get the benefit of it.
You mean including the array from the TR sniff in the For that matter - the splitting out of the files as you're doing in this PR will also affect some rulesets, so you may want to add an action item to review & adjust the existing rulesets for the changes you are making. |
I am not that keen on duplicating checks just so that we have backwards compatibility. I expect in most WP projects there is no php.ini file. This check was looking for a function called
This is what I meant but I am not sure do we want to create a separate sniff for each item or if we can bundle a few together.
Thought of that, I added an action item. 😄 |
So the original sniff was wrong, but that doesn't mean it shouldn't be sniffed for. |
ff995f4
to
03e5524
Compare
The rulesets should be should checking the same things are were doing before the functions were modularized. I have place all of the restricted functions in <rule ref="WordPress.WP.AlternativeFunctions">
<properties>
<property name="exclude" value="curl,file_get_contents"/>
</properties>
</rule> The only remaining thing are the deprecated functions which are being discussed in #576 (comment) |
8f7f399
to
d041dad
Compare
I have added a start for a check for deprecated based on WPTT/WPThemeReview#77 @JDGrimes Would be interested on your inital feedback on the deprecated functions check. It is just a start. |
); | ||
'urlencode' => array( | ||
'type' => 'warning', | ||
'message' => '%s() should only be used when dealing with legacy applications rawurlencode should now de used instead. See http://php.net/manual/en/function.rawurlencode.php and http://www.faqs.org/rfcs/rfc3986.html', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo here, "de" instead of "be".
9bc4ff2
to
9ee9089
Compare
9ee9089
to
33b9489
Compare
Updated Summary of the PR
|
Anyone else still wants to have a look at this before merging ? Please let me know, if not, I'll merge this tomorrow. |
TODO * @file_get_contents WordPress#633
TODO * @file_get_contents WordPress#633
TODO * @file_get_contents WordPress#633
TODO * @file_get_contents WordPress#633
TODO * @file_get_contents WordPress#633
TODO * @file_get_contents WordPress#633
TODO * @file_get_contents WordPress#633
This is an intial start of fixing #582 & #576
Do you think I am on the right path?
TODO
WordPress.VIP.RestrictedFunctions