fix error in PHP 8: count(): Argument #1 ($value) must be of type Countable #36083
Open
2 tasks done
Labels
8.1.x
Branch
BO
Category: Back Office
Bug
Type: Bug
Database
Label: Which BO under menu is concerned
Minor
Severity: minor bug > https://build.prestashop.com/news/severity-classification
PR available
Solution: issue is being addressed
Ready
Status: Issue is ready to be worked on
Verified
The issue has been reproduced
Prerequisites
Describe the bug and add attachments
fix error in PHP 8: count(): Argument #1 ($value) must be of type Countable
Expected behavior
in code :
$tab = [];
foreach ($tables as $table) {
if ($this->attributExistInTable($attr, $table['table'])) {
$tab = $table['table'];
}
}
if (count($tab) == 1) {
return $tab;
}
in PHP 8 $tab = $table['table']; delete the array property ans $tab become a string
Steps to reproduce
2 . Create a new SQL request with join
Exemple :
SELECT p.id_product , p.reference FROM
ps_stock_available
sa INNER JOINps_product
p ON p.id_product
=sa.id_product
INNER JOINps_product_lang
pl on pl.id_product
=p.id_product
WHEREid_product_attribute
= 0 AND pl.id_lang
= 9 AND pl.available_later
= 'Hors Stock' AND sa.quantity
<= 0 AND p.active
=1PrestaShop version(s) where the bug happened
All Version
PHP version(s) where the bug happened
PHP 8.1
If your bug is related to a module, specify its name and its version
No response
Your company or customer's name goes here (if applicable).
No response
The text was updated successfully, but these errors were encountered: