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

fix error in PHP 8: count(): Argument #1 ($value) must be of type Countable #36083

Open
2 tasks done
olecorre opened this issue May 3, 2024 · 1 comment · May be fixed by #36082
Open
2 tasks done

fix error in PHP 8: count(): Argument #1 ($value) must be of type Countable #36083

olecorre opened this issue May 3, 2024 · 1 comment · May be fixed by #36082
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

Comments

@olecorre
Copy link
Contributor

olecorre commented May 3, 2024

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

  1. go to BO SQL Manager
    2 . Create a new SQL request with join
    Exemple :
    SELECT p.id_product , p.reference FROM ps_stock_available sa INNER JOIN ps_product p ON p.id_product=sa.id_product INNER JOIN ps_product_lang pl on pl.id_product=p.id_product WHERE id_product_attribute = 0 AND pl.id_lang = 9 AND pl.available_later = 'Hors Stock' AND sa.quantity <= 0 AND p.active=1
  2. You have a error "count(): Argument .png fix in homeslider #1 ($value) must be of type Countable"

PrestaShop 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

@olecorre olecorre added Bug Type: Bug New New issue not yet processed by QA labels May 3, 2024
@florine2623
Copy link
Contributor

Hello @olecorre ,

I reproduce the issue with PrestaShop version 8.1.x and develop, I'll add this to the backlog so it can be fixed.

Screenshot 2024-05-13 at 11 50 59

count(): Argument #1 ($value) must be of type Countable|array, string given

Please be aware that some issues might take a very long time to be resolved. If this one is important to you and you cannot wait for it to be fixed on the project’s own time, we strongly suggest you consider contacting a professional to help you.

If you fix the issue on your end, please contribute it back to the project. Remember that the more people contribute, the better PrestaShop becomes for everyone.

Thank you

@florine2623 florine2623 added 8.1.x Branch BO Category: Back Office Database Label: Which BO under menu is concerned Verified The issue has been reproduced Ready Status: Issue is ready to be worked on Major Severity: major bug > https://build.prestashop.com/news/severity-classification PR available Solution: issue is being addressed Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification and removed New New issue not yet processed by QA Major Severity: major bug > https://build.prestashop.com/news/severity-classification labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
2 participants