<?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/search.php">
    <title>PEAR Bug Search Results</title>
    <link>http://pear.php.net/bugs/search.php?cmd=display&amp;package_name%5B0%5D=DBA</link>
    <description>Search Results</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/bug/17561" />

     </rdf:Seq>
    </items>
  </channel>

  <image rdf:about="http://pear.php.net/gifs/pearsmall.gif">
    <title>PEAR Bugs</title>
    <url>http://pear.php.net/gifs/pearsmall.gif</url>
    <link>http://pear.php.net/bugs</link>
  </image>

    <item rdf:about="http://pear.php.net/bug/17561">
      <title>DBA: Bug 17561 [Open] dba_exists() &amp; dba_fetch() do not return correct data</title>
      <link>http://pear.php.net/bugs/17561</link>
      <content:encoded><![CDATA[<pre>DBA Bug
Reported by davidgibson2
2010-07-05T19:30:14+00:00
PHP: 5.3.2 OS: Windows XP, Apache 2.2.15 Package Version: 1.1.1

Description:
------------
In compatibility.php ...
1) function dba_exists($key, &amp;$dba) returns true even when key does not exist
2) function dba_fetch($key, &amp;$dba) returns true instead of fetching key

Workarounds in compatibility.php ...

function dba_exists($key, &amp;$dba)
{
  //  return !PEAR::isError($dba-&gt;exists($key));
  //  (DG:) The above line appears to be incorrect. It is returning &quot;true&quot;
  //  even when exists($key) is false. Here is a workaround...
  return $dba-&gt;exists($key);
}

function dba_fetch($key, &amp;$dba)
{
  //  return !PEAR::isError($dba-&gt;fetch($key));
  //   (DG:) The above line appears to be incorrect, because we need to return the
  //  actual data, not a flag. Here is a workaround...

  $fetched = $dba-&gt;fetch($key);
  if ($fetched == &quot;DBA Error: key not found&quot;) {
  return false;
  }
  else return $fetched;
}



Test script:
---------------
&lt;?php
require_once 'DBA/Compatibility.php';
$id = dba_open (&quot;file_test&quot;, &quot;n&quot;, &quot;dbX&quot;);  // driver type is ignored
echo dba_insert ('key0001', 'This is an example!', $id);
echo dba_insert ('key9999', 'Another line of data', $id);
echo dba_delete ('key9999', $id); // delete key
echo dba_exists ('key9999', $id); // key is reported as still existing
echo dba_fetch  ('key0001', $id); // Returns true instead of data

Expected result:
----------------
111This is an example!

Actual result:
--------------
11111</pre>]]></content:encoded>
      <description><![CDATA[<pre>DBA Bug
Reported by davidgibson2
2010-07-05T19:30:14+00:00
PHP: 5.3.2 OS: Windows XP, Apache 2.2.15 Package Version: 1.1.1

Description:
------------
In compatibility.php ...
1) function dba_exists($key, &amp;$dba) returns true even when key does not exist
2) function dba_fetch($key, &amp;$dba) returns true instead of fetching key

Workarounds in compatibility.php ...

function dba_exists($key, &amp;$dba)
{
  //  return !PEAR::isError($dba-&gt;exists($key));
  //  (DG:) The above line appears to be incorrect. It is returning &quot;true&quot;
  //  even when exists($key) is false. Here is a workaround...
  return $dba-&gt;exists($key);
}

function dba_fetch($key, &amp;$dba)
{
  //  return !PEAR::isError($dba-&gt;fetch($key));
  //   (DG:) The above line appears to be incorrect, because we need to return the
  //  actual data, not a flag. Here is a workaround...

  $fetched = $dba-&gt;fetch($key);
  if ($fetched == &quot;DBA Error: key not found&quot;) {
  return false;
  }
  else return $fetched;
}



Test script:
---------------
&lt;?php
require_once 'DBA/Compatibility.php';
$id = dba_open (&quot;file_test&quot;, &quot;n&quot;, &quot;dbX&quot;);  // driver type is ignored
echo dba_insert ('key0001', 'This is an example!', $id);
echo dba_insert ('key9999', 'Another line of data', $id);
echo dba_delete ('key9999', $id); // delete key
echo dba_exists ('key9999', $id); // key is reported as still existing
echo dba_fetch  ('key0001', $id); // Returns true instead of data

Expected result:
----------------
111This is an example!

Actual result:
--------------
11111</pre>]]></description>
      <dc:date>2010-07-05T19:30:14+00:00</dc:date>
      <dc:creator>david &amp;#x61;&amp;#116; caves &amp;#x64;&amp;#111;&amp;#x74; org &amp;#x64;&amp;#111;&amp;#x74; uk</dc:creator>
      <dc:subject>DBA Bug</dc:subject>
    </item>
</rdf:RDF>
