mariuz                                   Wed, 28 Dec 2011 09:53:15 +0000

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

Log:
added testcase for Bug 47415

Bug: https://bugs.php.net/47415 (Assigned) PDO_Firebird segfaults when passing 
lowercased column name to bindColumn()
      
Changed paths:
    A   php/php-src/branches/PHP_5_3/ext/pdo_firebird/tests/bug_47415.phpt
    A   php/php-src/branches/PHP_5_4/ext/pdo_firebird/tests/bug_47415.phpt
    A   php/php-src/trunk/ext/pdo_firebird/tests/bug_47415.phpt

Added: php/php-src/branches/PHP_5_3/ext/pdo_firebird/tests/bug_47415.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo_firebird/tests/bug_47415.phpt          
                (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/pdo_firebird/tests/bug_47415.phpt  
2011-12-28 09:53:15 UTC (rev 321462)
@@ -0,0 +1,42 @@
+--TEST--
+Bug #47415 PDO_Firebird segfaults when passing lowercased column name to 
bindColumn()
+--SKIPIF--
+<?php extension_loaded("pdo_firebird") or die("skip"); ?>
+--FILE--
+<?php
+
+require("testdb.inc");
+
+$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die;
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+$value = '2';
+@$dbh->exec('DROP TABLE testz');
+$dbh->exec('CREATE TABLE testz (idx int NOT NULL PRIMARY KEY, txt 
VARCHAR(20))');
+$dbh->exec('INSERT INTO test VALUES(0, \'String0\')');
+$dbh->commit();
+
+$query = "SELECT idx, txt FROM test ORDER by idx";
+$idx = $txt = 0;
+$stmt = $dbh->prepare($query);
+$stmt->bindColumn('idx', $idx);
+$stmt->bindColumn('txt', $txt);
+$stmt->execute();
+$rows = $stmt->fetch(PDO::FETCH_BOUND);
+var_dump($stmt->fetch());
+var_dump($stmt->rowCount());
+
+
+$stmt = $dbh->prepare('DELETE FROM testz');
+$stmt->execute();
+
+$dbh->commit();
+
+$dbh->exec('DROP TABLE testz');
+
+unset($stmt);
+unset($dbh);
+
+?>
+--EXPECT--
+bool(false)
+int(1)

Added: php/php-src/branches/PHP_5_4/ext/pdo_firebird/tests/bug_47415.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/pdo_firebird/tests/bug_47415.phpt          
                (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/pdo_firebird/tests/bug_47415.phpt  
2011-12-28 09:53:15 UTC (rev 321462)
@@ -0,0 +1,42 @@
+--TEST--
+Bug #47415 PDO_Firebird segfaults when passing lowercased column name to 
bindColumn()
+--SKIPIF--
+<?php extension_loaded("pdo_firebird") or die("skip"); ?>
+--FILE--
+<?php
+
+require("testdb.inc");
+
+$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die;
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+$value = '2';
+@$dbh->exec('DROP TABLE testz');
+$dbh->exec('CREATE TABLE testz (idx int NOT NULL PRIMARY KEY, txt 
VARCHAR(20))');
+$dbh->exec('INSERT INTO test VALUES(0, \'String0\')');
+$dbh->commit();
+
+$query = "SELECT idx, txt FROM test ORDER by idx";
+$idx = $txt = 0;
+$stmt = $dbh->prepare($query);
+$stmt->bindColumn('idx', $idx);
+$stmt->bindColumn('txt', $txt);
+$stmt->execute();
+$rows = $stmt->fetch(PDO::FETCH_BOUND);
+var_dump($stmt->fetch());
+var_dump($stmt->rowCount());
+
+
+$stmt = $dbh->prepare('DELETE FROM testz');
+$stmt->execute();
+
+$dbh->commit();
+
+$dbh->exec('DROP TABLE testz');
+
+unset($stmt);
+unset($dbh);
+
+?>
+--EXPECT--
+bool(false)
+int(1)

Added: php/php-src/trunk/ext/pdo_firebird/tests/bug_47415.phpt
===================================================================
--- php/php-src/trunk/ext/pdo_firebird/tests/bug_47415.phpt                     
        (rev 0)
+++ php/php-src/trunk/ext/pdo_firebird/tests/bug_47415.phpt     2011-12-28 
09:53:15 UTC (rev 321462)
@@ -0,0 +1,42 @@
+--TEST--
+Bug #47415 PDO_Firebird segfaults when passing lowercased column name to 
bindColumn()
+--SKIPIF--
+<?php extension_loaded("pdo_firebird") or die("skip"); ?>
+--FILE--
+<?php
+
+require("testdb.inc");
+
+$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die;
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+$value = '2';
+@$dbh->exec('DROP TABLE testz');
+$dbh->exec('CREATE TABLE testz (idx int NOT NULL PRIMARY KEY, txt 
VARCHAR(20))');
+$dbh->exec('INSERT INTO test VALUES(0, \'String0\')');
+$dbh->commit();
+
+$query = "SELECT idx, txt FROM test ORDER by idx";
+$idx = $txt = 0;
+$stmt = $dbh->prepare($query);
+$stmt->bindColumn('idx', $idx);
+$stmt->bindColumn('txt', $txt);
+$stmt->execute();
+$rows = $stmt->fetch(PDO::FETCH_BOUND);
+var_dump($stmt->fetch());
+var_dump($stmt->rowCount());
+
+
+$stmt = $dbh->prepare('DELETE FROM testz');
+$stmt->execute();
+
+$dbh->commit();
+
+$dbh->exec('DROP TABLE testz');
+
+unset($stmt);
+unset($dbh);
+
+?>
+--EXPECT--
+bool(false)
+int(1)

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

Reply via email to