From:             kubis at pawouk dot net
Operating system: Windows XP
PHP version:      5.1.2
PHP Bug Type:     PDO related
Bug description:  PDOStatemenet::execute() returns always false

Description:
------------
PDOStatement::execute() returns false even if the statement has been
executed correctly.

I have tried it with PDO drivers for postgresql packaged with PHP version
5.1, it returns correctly true, but with version 5.2.1 it returns false. I
ran into this problem while executing unit tests after an upgrade.

According to manual page should PDOStatement::execute() return true if the
statement has been executed properly or false if not

Reproduce code:
---------------
try {
        $db = DBShop::getInstance();    //
        $stmt = $db->prepare('SELECT 1 AS testcolumn1, 2 AS testcolumn2');
        $count1 = $stmt->columnCount();
        $res = $stmt->execute();
        $count2 = $stmt->columnCount();
} catch (Exception $e){
        $fail[] = self::errorMsg($e, 'Unable to test columnCount()');
        break;
}
$this->assertTrue($res, 'DBStatement::execute() returned false, should be
true');
$this->assertSame(2, $count2, 'DBStatement::columnCount() did not return
expected value');

Expected result:
----------------
no failure in unit test:
- $res is true
- $count2 is 2

Actual result:
--------------
PHPUnit reports "DBStatement::execute() returned false, should be true",
so $res is not true; but $count2 is integer of value 2, thus the statement
has been executed properly

-- 
Edit bug report at http://bugs.php.net/?id=37026&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37026&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=37026&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37026&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37026&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37026&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37026&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37026&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37026&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37026&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37026&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37026&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37026&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37026&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37026&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37026&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37026&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37026&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37026&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37026&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37026&r=mysqlcfg

Reply via email to