PHP 8.1's PDO not properly handling prepared statements with IN clause containing empty values
I'm working on a project and hit a roadblock... I'm working with an scenario with PHP 8.1 while using PDO prepared statements with the IN clause. In particular, when I prepare a statement that expects an array of parameters, it seems to misinterpret empty values in the array. Here's my setup: ```php $ids = [1, 2, 3, '']; // Notice the empty string $query = 'SELECT * FROM users WHERE id IN (' . implode(',', array_fill(0, count($ids), '?')) . ')'; $stmt = $pdo->prepare($query); $stmt->execute($ids); ``` Instead of executing successfully, I'm getting an SQL behavior saying: `SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens`. I've tried various ways to fix this, including filtering out empty values before preparing the statement, but that seems counterintuitive since I might want to include a conditional check for optional parameters. I also attempted to directly bind parameters using a loop, but the same behavior continues. Is there a better approach to handle optional parameters in an IN clause without running into this scenario? Any insights or best practices would be greatly appreciated. I'm working on a service that needs to handle this. What's the best practice here?