|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-06-11 21:53 UTC] mbeccati@php.net
-Status: Open
+Status: Verified
-Assigned To:
+Assigned To: mbeccati
[2015-06-11 21:53 UTC] mbeccati@php.net
[2015-06-12 00:09 UTC] mbeccati@php.net
[2015-06-12 00:09 UTC] mbeccati@php.net
-Status: Verified
+Status: Closed
[2015-06-23 18:04 UTC] ab@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 06:00:01 2025 UTC |
Description: ------------ If pass a numeric array with gaps in keys as argument of PDOStatement::execute(), DB returns not all matched rows. Test script: --------------- $needValues = [ 'aaa', 'bbb', 'ccc', 'bbb', // Copy of key 1. 'ddd' ]; $needValues = array_unique($needValues); // Produce array with keys gap // $needValues = array_values(array_unique($needValues)); // No keys gap => NO BUG $sql = 'SELECT "value" FROM "values_table" WHERE "value" IN (%s)'; $sql = sprintf($sql, implode(',', array_fill(0, count($needValues), '?'))); $stmt = $postgresDb->prepare($sql); $stmt->execute($needValues); var_dump($stmt->fetchAll()); Expected result: ---------------- "ddd" "ccc" "bbb" "aaa" Actual result: -------------- "ccc" "bbb" "aaa"