Doc #19303 [Opn]: Using an indexed type array with assoc or object fetch doesn't set types
| From: | danielc at analysisandsolutions dot com | Date: | Fri, 09 Nov 2012 14:34:57 +0000 |
| Subject: | Doc #19303 [Opn]: Using an indexed type array with assoc or object fetch doesn't set types | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-9314@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19303&edit=1
ID: 19303
Updated by: danielc@analysisandsolutions.com
Reported By: mike at silverorange dot com
Summary: Using an indexed type array with assoc or object
fetch doesn't set types
Status: Open
Type: Documentation Problem
Package: MDB2
Operating System: Irrelevant
Package Version: SVN
PHP Version: Irrelevant
Roadmap Versions:
New Comment:
Hey Mike:
Haven't forgotten about this. I have some ideas for more unit tests to
demonstrate potential pitfalls. I'll post back here once they're
committed.
Thanks,
--Dan
Previous Comments:
------------------------------------------------------------------------
[2012-11-01 20:27:21] gauthierm
In #9502, an incomplete assoc array of types is being passed.
In #18203, no explicit types are passed and introspective typing is used
($types =
true). The bug is the enumerated types array built by introspection is
not correct.
These use cases are not contradictory to passing an explicit enum array
of types for a
fetch assoc or fetch obj row.
Before I work on a patch to add enum type array support back to assoc
and obj
fetches, can you think of a use case where it will break?
------------------------------------------------------------------------
[2012-10-25 21:31:12] danielc
Hi Mike:
Ugh. So this is a BC break from 2.4.x. This is definitely needs
documentation, particularly in the release notes.
While passing an enum array of types worked in some cases in 2.4.x,
there are some cases it did not. See bug #9502 and bug #18203.
Here's some history of the code in question:
Original code in 2.4.x: r234892
http://svn.php.net/viewvc?view=revision&revision=308955
all quippo
http://svn.php.net/viewvc?view=revision&revision=321210
mdb2 me
http://svn.php.net/viewvc?view=revision&revision=321234
mdb2 me
http://svn.php.net/viewvc?view=revision&revision=322953
all gauthierm
http://svn.php.net/viewvc?view=revision&revision=328145
drivers me
A patch that passes all of the unit tests is always welcome,
particularly those in tests/Standard/UsageTest.php
tests/Standard/BugsTest.php.
------------------------------------------------------------------------
[2012-10-25 11:19:05] gauthierm
What doesn't work in the patch? In MDB2 2.4.x, enumerated arrays of
types worked
with assoc and object fetch methods.
------------------------------------------------------------------------
[2012-10-25 02:21:15] danielc
-Type: Bug
+Type: Documentation Problem
This is by design.
The code in the each driver's fetchRow() method and in
MDB2_Result_Common::setResultTypes() are explicitly constructed to have
enumerated arrays of types go with enumerated arrays of results and have
associative arrays of types go with associative and object results.
That aside, a modified version of the provided patch doesn't work for
me.
I added some tests in commit r328136. The unsupported variations are
commented out.
The documentation could (well, should) be better about explaining this,
so I'll convert it to a documentation ticket.
------------------------------------------------------------------------
[2012-02-23 19:57:46] gauthierm
Added #patch
bug:19303;patch:MDB2-indexed-types-assoc-fetch;revision:1330027066;.
------------------------------------------------------------------------
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
http://pear.php.net/bugs/bug.php?id=19303
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19303&edit=1