Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Too few arguments to function _doing_it_wrong() #5074

Closed
pluginslab opened this issue Nov 4, 2021 · 2 comments · Fixed by #5134
Closed

Too few arguments to function _doing_it_wrong() #5074

pluginslab opened this issue Nov 4, 2021 · 2 comments · Fixed by #5134
Assignees
Labels
category: extensibility Work involving adding or updating extensibility. Useful to combine with other scopes impacted. type: bug The issue/PR concerns a confirmed bug. type: good first issue The issue is a good candidate for the first community contribution/for a newcomer to the team.

Comments

@pluginslab
Copy link

Describe the bug

The call to the function _doing_it_wrong() at line 67 inside src/Integrations/IntegrationRegistry.php has a missing parameter: $name.

Expected behavior

A correct function call with 3 parameters is expected otherwise a PHP Fatal error is produced.

WordPress (please complete the following information):

  • Core version: [e.g. 5.8.0]
  • WooCommerce Blocks version: [e.g. 6.2.0]
@pluginslab pluginslab added the type: bug The issue/PR concerns a confirmed bug. label Nov 4, 2021
@pluginslab
Copy link
Author

pluginslab commented Nov 4, 2021

It's actually not the $name that is missing, but the version variable, which hasn't a default so it must be provided.

And I just noticed that all three calls to the function _doing_it_wrong() are missing their third parameter.

I got to this error when I was registering a payment method used on the checkout block twice, that is, with the same name.

@nerrad
Copy link
Contributor

nerrad commented Nov 5, 2021

I'm guessing this is an Uncaught ArgumentcountError that gets thrown?

It looks like the _doing_it_wrong WordPress function actually accounts for whether $version is present or not so it appears that this may be a bug with the WP core function vs than our usage of it. At one point (I think prior to PHP 7.1), this would produce a PHP warning not an error.

We can eliminate this error (on evironments greather than PHP 7.1) by explicitly adding a $version value (eg '' in order to satisfy the intentional falsey value) but that seems like a workaround for WP core not accounting for newer PHP version requirements and the implicit default for $version of empty string.

@nerrad nerrad added category: extensibility Work involving adding or updating extensibility. Useful to combine with other scopes impacted. type: good first issue The issue is a good candidate for the first community contribution/for a newcomer to the team. labels Nov 5, 2021
@mikejolley mikejolley self-assigned this Nov 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
category: extensibility Work involving adding or updating extensibility. Useful to combine with other scopes impacted. type: bug The issue/PR concerns a confirmed bug. type: good first issue The issue is a good candidate for the first community contribution/for a newcomer to the team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants