Bug #81103 [Opn->Wfx]: mysqli_both overwrites numerical indexes
| From: | nikic@php.net | Date: | Mon, 14 Jun 2021 09:13:43 +0000 |
| Subject: | Bug #81103 [Opn->Wfx]: mysqli_both overwrites numerical indexes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234406@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81103&edit=1
ID: 81103
Updated by: nikic@php.net
Reported by: dharman@php.net
Summary: mysqli_both overwrites numerical indexes
-Status: Open
+Status: Wont fix
Type: Bug
Package: MySQLi related
PHP Version: 7.4.20
Block user comment: N
Private report: N
New Comment:
Closing as won't fix per above discussion.
Previous Comments:
------------------------------------------------------------------------
[2021-06-08 14:05:02] nikic@php.net
I'm inclined to close this as Won't Fix. Bug #79084 was a legitimate issue, but here there
is no obviously correct way in which it should behave.
------------------------------------------------------------------------
[2021-06-04 11:32:24] cmb@php.net
FTR, this is related to the fix for bug #79084.
Anyhow, given that column names may be numeric, I don't think the
mentioned part of the documentation makes sense. I suggest to
reword that to something like:
| If two or more columns of the result have the same field names,
| the last column will take precedence and overwrite the earlier
| data. It is recommended to use the <constant>MYSQLI_NUM</constant
| <parameter>mode</parameter> for such queries.
------------------------------------------------------------------------
[2021-06-03 20:37:47] fffg at gaeeer dot gg
garbage in, garbage out and a query like that shouldn't exist in any codebase - and if it
exists common sense says USE_BOTH makes no sense
------------------------------------------------------------------------
[2021-06-03 20:21:48] dharman@php.net
Sorry, I messed up the test case.
This one should be better:
$res = $mysqli->query("SELECT 'a' AS
0, 'b' AS
0");
The expected result here is
array(2) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
}
The idea is that numerical indices must take precedence over the associative keys. I don't have
a solution for this.
------------------------------------------------------------------------
[2021-06-03 19:55:05] requinix@php.net
So don't use numerical aliases? Or don't use MYSQLI_BOTH?
What kind of solution do you have in mind?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=81103
--
Edit this bug report at https://bugs.php.net/bug.php?id=81103&edit=1