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

[Qual] Suspicious passing of list called 'variations' to 'combinations' argument and not 'variations'. #27374

Open
mdeweerd opened this issue Jan 9, 2024 · 0 comments
Labels
Bug This is a bug (something does not work as expected)

Comments

@mdeweerd
Copy link
Contributor

mdeweerd commented Jan 9, 2024

Bug

Phan report:

Warning: ProductCombination.class.php: PhanPluginSuspiciousParamPosition: Suspicious order for argument variations - This is getting passed to parameter #4 (array $variations) of \ProductCombination::createProductCombination(\User $user, \Product $product, array $combinations, array $variations, array|bool $price_var_percent = false, bool|float $forced_pricevar = false, bool|float $forced_weightvar = false, bool|string $forced_refvar = false, string $ref_ext = '') defined at htdocs/variants/class/ProductCombination.class.php:716

Code:

foreach ($combinations as $combination) {
$variations = array();
foreach ($prodcomb2val->fetchByFkCombination($combination->id) as $tmp_pc2v) {
$variations[$tmp_pc2v->fk_prod_attr] = $tmp_pc2v->fk_prod_attr_val;
}
if ($this->createProductCombination(
$user,
$destProduct,
$variations,
array(),
$combination->variation_price_percentage,
$combination->variation_price,
$combination->variation_weight

It does look suspicious to create contents for a list called $variations from a list called $combinations and then pass $variations to the method's argument called combinations instead of passing it to variations.

Environment Version

At least 16.0 up to develop included

Environment OS

No response

Environment Web server

No response

Environment PHP

No response

Environment Database

No response

Environment URL(s)

No response

Expected and actual behavior

No response

Steps to reproduce the behavior

No response

Attached files

No response

@mdeweerd mdeweerd added the Bug This is a bug (something does not work as expected) label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug (something does not work as expected)
Projects
None yet
Development

No branches or pull requests

1 participant