cvs: pear /MDB2 MDB2.php package.php /MDB2/tests MDB2_internals_testcase.php
[email protected] ("Lorenzo Alberton")
| Newsgroups | php.pear.cvs |
|---|---|
| Message-ID | <cvsquipo1209816851@cvsserver> |
quipo Sat May 3 12:14:11 2008 UTC
Modified files:
/pear/MDB2 MDB2.php package.php
/pear/MDB2/tests MDB2_internals_testcase.php
Log:
fixed bug #13811: _skipDelimitedStrings() fails on empty strings
http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2.php?r1=1.322&r2=1.323&diff_format=u
Index: pear/MDB2/MDB2.php
diff -u pear/MDB2/MDB2.php:1.322 pear/MDB2/MDB2.php:1.323
--- pear/MDB2/MDB2.php:1.322 Sat May 3 09:26:11 2008
+++ pear/MDB2/MDB2.php Sat May 3 12:14:11 2008
@@ -43,7 +43,7 @@
// | Author: Lukas Smith <[email protected]> |
// +----------------------------------------------------------------------+
//
-// $Id: MDB2.php,v 1.322 2008/05/03 09:26:11 quipo Exp $
+// $Id: MDB2.php,v 1.323 2008/05/03 12:14:11 quipo Exp $
//
/**
@@ -3026,7 +3026,7 @@
return $err;
}
}
- } while ($ignore['escape'] && $query[($end_quote - 1)] == $ignore['escape']);
+ } while ($ignore['escape'] && $query[($end_quote - 1)] == $ignore['escape'] && $end_quote-1 != $start_quote);
$position = $end_quote + 1;
return $position;
}
http://cvs.php.net/viewvc.cgi/pear/MDB2/package.php?r1=1.289&r2=1.290&diff_format=u
Index: pear/MDB2/package.php
diff -u pear/MDB2/package.php:1.289 pear/MDB2/package.php:1.290
--- pear/MDB2/package.php:1.289 Sat Apr 5 15:39:22 2008
+++ pear/MDB2/package.php Sat May 3 12:14:11 2008
@@ -8,6 +8,7 @@
$state = 'beta';
$notes = <<<EOT
- fixed bug #12912: replace() documentation
+- fixed bug #13811: _skipDelimitedStrings() fails on empty strings
open todo items:
- handle autoincrement fields in alterTable()
http://cvs.php.net/viewvc.cgi/pear/MDB2/tests/MDB2_internals_testcase.php?r1=1.1&r2=1.2&diff_format=u
Index: pear/MDB2/tests/MDB2_internals_testcase.php
diff -u pear/MDB2/tests/MDB2_internals_testcase.php:1.1 pear/MDB2/tests/MDB2_internals_testcase.php:1.2
--- pear/MDB2/tests/MDB2_internals_testcase.php:1.1 Fri Mar 2 16:39:22 2007
+++ pear/MDB2/tests/MDB2_internals_testcase.php Sat May 3 12:14:11 2008
@@ -42,7 +42,7 @@
// | Andrew Hill <[email protected]> |
// +----------------------------------------------------------------------+
//
-// $Id: MDB2_internals_testcase.php,v 1.1 2007/03/02 16:39:22 quipo Exp $
+// $Id: MDB2_internals_testcase.php,v 1.2 2008/05/03 12:14:11 quipo Exp $
require_once 'MDB2_testcase.php';
@@ -432,8 +432,7 @@
}
/**
- * Tests that the MDB2::setDSN() method correctly sets
- * the DSN.
+ * Tests that the MDB2::setDSN() method correctly sets the DSN.
*/
function test_setDSN()
{
@@ -453,8 +452,7 @@
}
/**
- * Tests that the MDB2::getDSN() method correctly gets
- * the DSN.
+ * Tests that the MDB2::getDSN() method correctly gets the DSN.
*/
function test_getDSN()
{
@@ -517,8 +515,7 @@
}
/**
- * Tests that the MDB2::getIndexName() method correctly gets
- * index names.
+ * Tests that the MDB2::getIndexName() method correctly gets index names.
*/
function test_getIndexName()
{
@@ -542,6 +539,27 @@
$this->assertNull($this->db->in_transaction, 'disconnect');
$this->assertNull($this->db->nested_transaction_counter, 'disconnect');
}
+
+ /**
+ * Test that the MDB2::_skipDelimitedStrings() method correctly recognizes
+ * parameter placeholders from quoted strings
+ */
+ function test_skipDelimitedStrings() {
+ $query = "UPDATE tbl SET fld='' WHERE fld2=:param AND fld3=':fakeparam' AND fld3=:param2";
+ $this->assertEquals(0, $this->db->_skipDelimitedStrings($query, 0, 0));
+ $this->assertEquals(18, $this->db->_skipDelimitedStrings($query, 18, 19));
+ $this->assertEquals(20, $this->db->_skipDelimitedStrings($query, 20, 20));
+ $this->assertEquals(21, $this->db->_skipDelimitedStrings($query, 19, 21));
+ $this->assertEquals(30, $this->db->_skipDelimitedStrings($query, 30, 33));
+ $this->assertEquals(30, $this->db->_skipDelimitedStrings($query, 30, 34));
+ $this->assertEquals(33, $this->db->_skipDelimitedStrings($query, 33, 33));
+ $this->assertEquals(50, $this->db->_skipDelimitedStrings($query, 50, 50));
+ $this->assertEquals(61, $this->db->_skipDelimitedStrings($query, 49, 51));
+ $this->assertEquals(52, $this->db->_skipDelimitedStrings($query, 52, 52));
+ $this->assertEquals(70, $this->db->_skipDelimitedStrings($query, 70, 72));
+ $this->assertEquals(71, $this->db->_skipDelimitedStrings($query, 71, 72));
+ $this->assertEquals(72, $this->db->_skipDelimitedStrings($query, 72, 72));
+ }
}