<?xml version="1.0"?>
<?xml-stylesheet 
 href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel rdf:about="http://pear.php.net/bugs/8734/bug">
    <title>PEAR Bug #8734</title>
    <link>http://pear.php.net/bugs/8734</link>
    <description>[Closed] Wrong use of list()</description>
    <dc:language>en-us</dc:language>
    <dc:creator>pear-webmaster@lists.php.net</dc:creator>
    <dc:publisher>pear-webmaster@lists.php.net</dc:publisher>
    <admin:generatorAgent rdf:resource="http://pear.php.net/bugs"/>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    <items>
     <rdf:Seq>
      <rdf:li rdf:resource="http://pear.php.net/bugs/8734"/>
      <rdf:li rdf:resource="http://pear.php.net/bugs/8734/2006-09-19+06%3A34%3A48#2006-09-19+06%3A34%3A48"/>
      <rdf:li rdf:resource="http://pear.php.net/bugs/8734/2006-09-19+06%3A26%3A14#2006-09-19+06%3A26%3A14"/>
     </rdf:Seq>
    </items>
  </channel>
    <item rdf:about="http://pear.php.net/bugs/8734">
      <title>chrismontijn@... [2006-09-19 06:07:49]</title>
      <link>http://pear.php.net/bugs/8734</link>
      <description><![CDATA[<pre>Translation2 Bug
Reported by chrismontijn@...
2006-09-19T10:07:49-00:00
PHP: 4.4.2 OS: Windows XP Package Version: 2.0.0beta11

Description:
------------
When using an existing db connection, with fetchmode set to associative, to instantiate an translation2 object at least one (didn't check further) list() function is not working properly. For example in the MDB2.php container on line 217 in function getPage() there is a list() not working properly, because the indices of the result array are tablecolumnnames instead of numbers (starting from zero).


Test script:
---------------
$dsn = 'somedsn';

$db =&amp; MDB2::connect($dsn);
// !This is where it goes wrong
$db-&gt;setFetchmode(MDB2_FETCHMODE_ASSOC);

// instantiate translation2 with this database connection
$tr =&amp; Translation2::factory($dbdriver, &amp;$db, $TR_options);

$tr-&gt;setLang('somelang');

$tr =&amp; $tr-&gt;getDecorator('CacheMemory');

$tr-&gt;setPageID('someGroup');

$tr-&gt;get('somestr');

Expected result:
----------------
I expect to see no notices about undefined offsets. 

Actual result:
--------------
When display notices are on in php.ini page shows following errors:

Notice: Undefined offset: 1 in c:\Inetpub\wwwroot\pear\Translation2\Container\mdb2.php on line 217

Notice: Undefined offset: 0 in c:\Inetpub\wwwroot\pear\Translation2\Container\mdb2.php on line 217</pre>]]></description>
      <content:encoded><![CDATA[<pre>Translation2 Bug
Reported by chrismontijn@...
2006-09-19T10:07:49-00:00
PHP: 4.4.2 OS: Windows XP Package Version: 2.0.0beta11

Description:
------------
When using an existing db connection, with fetchmode set to associative, to instantiate an translation2 object at least one (didn't check further) list() function is not working properly. For example in the MDB2.php container on line 217 in function getPage() there is a list() not working properly, because the indices of the result array are tablecolumnnames instead of numbers (starting from zero).


Test script:
---------------
$dsn = 'somedsn';

$db =&amp; MDB2::connect($dsn);
// !This is where it goes wrong
$db-&gt;setFetchmode(MDB2_FETCHMODE_ASSOC);

// instantiate translation2 with this database connection
$tr =&amp; Translation2::factory($dbdriver, &amp;$db, $TR_options);

$tr-&gt;setLang('somelang');

$tr =&amp; $tr-&gt;getDecorator('CacheMemory');

$tr-&gt;setPageID('someGroup');

$tr-&gt;get('somestr');

Expected result:
----------------
I expect to see no notices about undefined offsets. 

Actual result:
--------------
When display notices are on in php.ini page shows following errors:

Notice: Undefined offset: 1 in c:\Inetpub\wwwroot\pear\Translation2\Container\mdb2.php on line 217

Notice: Undefined offset: 0 in c:\Inetpub\wwwroot\pear\Translation2\Container\mdb2.php on line 217</pre>]]></content:encoded>
      <dc:date>2006-09-19T10:07:49-00:00</dc:date>
    </item>
    <item rdf:about="http://pear.php.net/bugs/8734/2006-09-19+06%3A34%3A48#2006-09-19+06%3A34%3A48">
      <title>quipo [2006-09-19 10:34]</title>
      <link>http://pear.php.net/bugs/8734#1158662088</link>
      <description><![CDATA[<pre>This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.</pre>]]></description>
      <content:encoded><![CDATA[<pre>This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.</pre>]]></content:encoded>
      <dc:date>2006-09-19T10:34:48-00:00</dc:date>
    </item>
    <item rdf:about="http://pear.php.net/bugs/8734/2006-09-19+06%3A26%3A14#2006-09-19+06%3A26%3A14">
      <title>chrismontijn@... [2006-09-19 10:26]</title>
      <link>http://pear.php.net/bugs/8734#1158661574</link>
      <description><![CDATA[<pre>A simple solution is to change line 217 in container/mdb2.php

while (list($key, $value) = $res-&gt;fetchRow()) {

to

while (list($key, $value) = $res-&gt;fetchRow(MDB2_FETCHMODE_ORDERED)) {</pre>]]></description>
      <content:encoded><![CDATA[<pre>A simple solution is to change line 217 in container/mdb2.php

while (list($key, $value) = $res-&gt;fetchRow()) {

to

while (list($key, $value) = $res-&gt;fetchRow(MDB2_FETCHMODE_ORDERED)) {</pre>]]></content:encoded>
      <dc:date>2006-09-19T10:26:14-00:00</dc:date>
    </item>
</rdf:RDF>