felipe                                   Sat, 01 Aug 2009 23:10:11 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=286636

Log:
- Fixed bug #49125 (Error in dba_exists C code)
  patch by: jdornan at stanford dot edu

Bug: http://bugs.php.net/49125 (Open) Error in dba_exists C code
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/NEWS
    U   php/php-src/branches/PHP_5_2/ext/dba/dba_db4.c
    A   php/php-src/branches/PHP_5_2/ext/dba/tests/bug49125.phpt
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/dba/dba_db4.c
    A   php/php-src/branches/PHP_5_3/ext/dba/tests/bug49125.phpt
    U   php/php-src/trunk/ext/dba/dba_db4.c
    A   php/php-src/trunk/ext/dba/tests/bug49125.phpt

Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS   2009-08-01 20:44:00 UTC (rev 286635)
+++ php/php-src/branches/PHP_5_2/NEWS   2009-08-01 23:10:11 UTC (rev 286636)
@@ -7,6 +7,7 @@

 - Fixed bug #49132 (posix_times returns false without error).
   (phpbugs at gunnu dot us)
+- Fixed bug #49125 (Error in dba_exists C code). (jdornan at stanford dot edu)
 - Fixed bug #49074 (private class static fields can be modified by using
   reflection). (Jani)
 - Fixed bug #49052 (context option headers freed too early when using

Modified: php/php-src/branches/PHP_5_2/ext/dba/dba_db4.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/dba/dba_db4.c      2009-08-01 20:44:00 UTC 
(rev 286635)
+++ php/php-src/branches/PHP_5_2/ext/dba/dba_db4.c      2009-08-01 23:10:11 UTC 
(rev 286636)
@@ -175,7 +175,15 @@
        DB4_GKEY;

        memset(&gval, 0, sizeof(gval));
+
+       if (info->flags & DBA_PERSISTENT) {
+               gval.flags |= DB_DBT_MALLOC;
+       }
+
        if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
+               if (info->flags & DBA_PERSISTENT) {
+                       free(gval.data);
+               }
                return SUCCESS;
        }
        return FAILURE;

Added: php/php-src/branches/PHP_5_2/ext/dba/tests/bug49125.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/dba/tests/bug49125.phpt                    
        (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/dba/tests/bug49125.phpt    2009-08-01 
23:10:11 UTC (rev 286636)
@@ -0,0 +1,27 @@
+--TEST--
+Bug #49125 (Error in dba_exists C code)
+--SKIPIF--
+<?php
+       $handler = 'db4';
+       require_once dirname(__FILE__) .'/skipif.inc';
+?>
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+$handler = 'db4';
+require_once dirname(__FILE__) .'/test.inc';
+
+$db = dba_popen($db_filename, 'c', 'db4');
+
+dba_insert('foo', 'foo', $db);
+
+var_dump(dba_exists('foo', $db));
+
+dba_close($db);
+
+unlink($db_filename);
+
+--EXPECT--
+bool(true)


Property changes on: php/php-src/branches/PHP_5_2/ext/dba/tests/bug49125.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2009-08-01 20:44:00 UTC (rev 286635)
+++ php/php-src/branches/PHP_5_3/NEWS   2009-08-01 23:10:11 UTC (rev 286636)
@@ -10,6 +10,7 @@

 - Fixed bug #49132 (posix_times returns false without error).
   (phpbugs at gunnu dot us)
+- Fixed bug #49125 (Error in dba_exists C code). (jdornan at stanford dot edu)
 - Fixed bug #49092 (ReflectionFunction fails to work with functions in fully
   qualified namespaces). (Kalle, Jani)
 - Fixed bug #49074 (private class static fields can be modified by using

Modified: php/php-src/branches/PHP_5_3/ext/dba/dba_db4.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/dba/dba_db4.c      2009-08-01 20:44:00 UTC 
(rev 286635)
+++ php/php-src/branches/PHP_5_3/ext/dba/dba_db4.c      2009-08-01 23:10:11 UTC 
(rev 286636)
@@ -175,7 +175,15 @@
        DB4_GKEY;

        memset(&gval, 0, sizeof(gval));
+
+       if (info->flags & DBA_PERSISTENT) {
+               gval.flags |= DB_DBT_MALLOC;
+       }
+
        if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
+               if (info->flags & DBA_PERSISTENT) {
+                       free(gval.data);
+               }
                return SUCCESS;
        }
        return FAILURE;

Added: php/php-src/branches/PHP_5_3/ext/dba/tests/bug49125.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/dba/tests/bug49125.phpt                    
        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/dba/tests/bug49125.phpt    2009-08-01 
23:10:11 UTC (rev 286636)
@@ -0,0 +1,27 @@
+--TEST--
+Bug #49125 (Error in dba_exists C code)
+--SKIPIF--
+<?php
+       $handler = 'db4';
+       require_once dirname(__FILE__) .'/skipif.inc';
+?>
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+$handler = 'db4';
+require_once dirname(__FILE__) .'/test.inc';
+
+$db = dba_popen($db_filename, 'c', 'db4');
+
+dba_insert('foo', 'foo', $db);
+
+var_dump(dba_exists('foo', $db));
+
+dba_close($db);
+
+unlink($db_filename);
+
+--EXPECT--
+bool(true)


Property changes on: php/php-src/branches/PHP_5_3/ext/dba/tests/bug49125.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/trunk/ext/dba/dba_db4.c
===================================================================
--- php/php-src/trunk/ext/dba/dba_db4.c 2009-08-01 20:44:00 UTC (rev 286635)
+++ php/php-src/trunk/ext/dba/dba_db4.c 2009-08-01 23:10:11 UTC (rev 286636)
@@ -175,7 +175,15 @@
        DB4_GKEY;

        memset(&gval, 0, sizeof(gval));
+
+       if (info->flags & DBA_PERSISTENT) {
+               gval.flags |= DB_DBT_MALLOC;
+       }
+
        if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
+               if (info->flags & DBA_PERSISTENT) {
+                       free(gval.data);
+               }
                return SUCCESS;
        }
        return FAILURE;

Added: php/php-src/trunk/ext/dba/tests/bug49125.phpt
===================================================================
--- php/php-src/trunk/ext/dba/tests/bug49125.phpt                               
(rev 0)
+++ php/php-src/trunk/ext/dba/tests/bug49125.phpt       2009-08-01 23:10:11 UTC 
(rev 286636)
@@ -0,0 +1,27 @@
+--TEST--
+Bug #49125 (Error in dba_exists C code)
+--SKIPIF--
+<?php
+       $handler = 'db4';
+       require_once dirname(__FILE__) .'/skipif.inc';
+?>
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+$handler = 'db4';
+require_once dirname(__FILE__) .'/test.inc';
+
+$db = dba_popen($db_filename, 'c', 'db4');
+
+dba_insert('foo', 'foo', $db);
+
+var_dump(dba_exists('foo', $db));
+
+dba_close($db);
+
+unlink($db_filename);
+
+--EXPECT--
+bool(true)


Property changes on: php/php-src/trunk/ext/dba/tests/bug49125.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to