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

PHP 7.4 warning #1389

Closed
jonathanstegall opened this issue Nov 18, 2020 · 3 comments · Fixed by #1400
Closed

PHP 7.4 warning #1389

jonathanstegall opened this issue Nov 18, 2020 · 3 comments · Fixed by #1400

Comments

@jonathanstegall
Copy link
Contributor

Describe the bug

When running a PHPCS compatibility check for PHP 7.4, the only thing CMB2 seems to report is this, in the file /cmb2/includes/CMB2_Base.php:

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 "$message" was used, and possibly changed (by reference), on line 416.

Steps to reproduce (I have confirmed I can reproduce this issue on the develop branch):

  1. Set up PHPCompatibilityWP
  2. In the root of WordPress where composer.json is, run the command ./vendor/bin/phpcs -p . --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 7.3-

Possible Solution

Possibly, the solution is to move $args = func_get_args(); before the if ( is_numeric( $message ) ) { call.

Possible Solution's Risk Level

Screenshots

If applicable, add screenshots to help explain your problem.

Your Environment

Browser name and version:
Operating System and version (desktop or mobile): macOS Catalina.

@tw2113
Copy link
Contributor

tw2113 commented Nov 19, 2020

Definitely likely valid by all means.

I am amused that that line in question, is inside a deprecated_param() method :D

@jonathanstegall
Copy link
Contributor Author

Wanted to check on this. I could submit a PR with the line of code I mentioned, although since it's in a deprecated method I'm not really sure how I would test it.

@jtsternberg
Copy link
Member

Please do submit a PR. To test, set a default callback using the default param (vs the default_cb param), and you should see the deprecated warning.

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 a pull request may close this issue.

3 participants