**Issue:** Site generates frequent warnings on PHP 8.1.x (HPOS enabled): ``` Warning: Undefined array key "post__in" in /wp-content/plugins/b2bking/public/class-b2bking-public.php on line 14133 ```
**Root Cause:** Line 14133 attempts to access `$query_vars['post__in']` without first checking if the array key exists: ```php $query_vars['post__in'] = is_array($query_vars['post__in']) ? $query_vars['post__in'] : array(); ```
In PHP 8.1+, accessing undefined array keys generates warnings.
We're observing the following warning that I believe is a straightforward fix. I hope this helps!
**Bug Report: PHP 8.1+ Warning - Undefined array key "post__in"**
**Issue:**
Site generates frequent warnings on PHP 8.1.x (HPOS enabled):
```
Warning: Undefined array key "post__in" in /wp-content/plugins/b2bking/public/class-b2bking-public.php on line 14133
```
**Root Cause:**
Line 14133 attempts to access `$query_vars['post__in']` without first checking if the array key exists:
```php
$query_vars['post__in'] = is_array($query_vars['post__in']) ? $query_vars['post__in'] : array();
```
In PHP 8.1+, accessing undefined array keys generates warnings.
**Fix Required:**
Add `isset()` check before accessing the array key:
```php
$query_vars['post__in'] = isset($query_vars['post__in']) && is_array($query_vars['post__in']) ? $query_vars['post__in'] : array();
```
**Environment:**
- PHP 8.1.32
- WordPress 6.8.1 with Woo 9.8.5HPOS enabled
- B2BKing plugin
**Impact:**
Generates multiple warnings in error logs, affecting debugging clarity.
Thanks Stefan. We'll give it a try.