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

[PHP 8.1 Compatibility] Potential Count On Null Error in ProductCollection Block Type #11668

Closed
Tracked by #11678
danielwrobert opened this issue Nov 8, 2023 · 1 comment
Assignees
Labels
block: product collection Issues related to the Product Collection block type: bug The issue/PR concerns a confirmed bug.

Comments

@danielwrobert
Copy link
Contributor

danielwrobert commented Nov 8, 2023

Describe the bug

Rector has reported issues with using count() in places there could be potentially non-countable data which can result in a fatal error.

To reproduce

Steps to reproduce the behavior:

  1. Setup a WordPress + WooCommerce site, with PHP 8.1 on the server.
  2. Run Rector scan on /src/BlockTypes/ProductCollection.php, as described in p7H4VZ-4x1-p2.
  3. Confirm CountOnNullRector rule is triggered.

Expected behavior

Running Rector against the file should not output any errors when scanned against PHP 8.1.

Additional context

See p7H4VZ-4x1-p2 (also linked above).

@danielwrobert danielwrobert added type: bug The issue/PR concerns a confirmed bug. block: product collection Issues related to the Product Collection block labels Nov 8, 2023
@danielwrobert danielwrobert self-assigned this Nov 8, 2023
@danielwrobert
Copy link
Contributor Author

Fixed in #11473.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: product collection Issues related to the Product Collection block type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
Development

No branches or pull requests

1 participant