When i ran the php compatibility in file modules\field_ui\field_ui.module found below issue
FILE: C:\xampp\htdocs\drupal7_project\modules\field_ui\field_ui.module
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
278 | ERROR | Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a parameter, but will instead provide the current value.
| | The parameter "$bundle" was changed on line 270.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 3126312-12.patch | 1.17 KB | mcdruid |
Comments
Comment #2
ravikk-drupal commentedfunc_get_args() should be placed at the beginning of a method or function,
changes in PHP 7.0 and onward.
Comment #3
ravikk-drupal commentedComment #4
mohangathala commentedComment #5
joseph.olstadComment #6
mohangathala commentedThis patch perfectly works for me. Screenshot attached for the same.
Comment #7
jungleComment #8
joseph.olstadComment #9
jungle@joseph.olstad thank you! Setting back to RTBC
Comment #10
joseph.olstadactually I think this comment makes a bit more sense, stretched to the 80 character limit per line.
Comment #11
taran2lThis one is not being triggered by any test; should a test coverage be added?
Update
It's not triggered because there is no issue:
$bundleargument is nor being used actually. Arguments are sliced at line 279 and only 5+ arguments are useful for the code after the line 279.Comment #12
mcdruid commentedI agree this doesn't seem to be necessary, but it's good to clean up the error from CodeSniffer.
Tweaked the patch a tiny bit, but it's making the same change.
Comment #13
mcdruid commentedComment #14
mcdruid commentedComment #15
liam morlandComment #16
fabianx commentedGenerally approved, but I disagree with the comment a little bit:
- I don't think it should be for avoiding code sniffs (that's not a good reason), but rather say something like:
"It is a good practice to put func_get_args() at the start of the function to avoid a changed function parameter to leak into the original arguments. By taking the copy early this is avoided. This behavior changed in PHP7: [link]"
Can be changed on commit.
It's also not a good practice to change given function parameters in the first place, but that's a debate for another day ;).
Comment #18
mcdruid commentedThanks everyone.
I changed the comment on commit to be more like @Fabianx's suggestion.