|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31710 return value of rollback() is inverted
Submitted: 2005-01-26 23:17 UTC Modified: 2005-01-27 11:21 UTC
From: cyrilleml at kbuilder dot net Assigned: georg (profile)
Status: Closed Package: MySQLi related
PHP Version: 5.0.3 OS: winXP Pro
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: cyrilleml at kbuilder dot net
New email:
PHP Version: OS:


 [2005-01-26 23:17 UTC] cyrilleml at kbuilder dot net

Functions rollback() works fine expected that
the return value is inverted.

if rollback() failed, return value is TRUE,
if rollback() success, return value is FALSE.

The problem is that the Documentation say the opposite.

So for my code work fine, I've to write:

if( $dbh1->rollback() ){
 printf( "DBH1 Failed to rollback : %s \n", $dbh1->error);


Reproduce code:
if( $dbh1->rollback() ){
 printf( "DBH1 Failed to rollback : %s \n", $dbh1->error);

Expected result:
if( ! $dbh1->rollback() ){
 printf( "DBH1 Failed to rollback : %s \n", $dbh1->error);
if( $dbh1->rollback() == FALSE ){
 printf( "DBH1 Failed to rollback : %s \n", $dbh1->error);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-26 23:59 UTC]
Assigning to Georg.
According to MySQL docs, mysql_autocommit(), mysql_commit() & mysql_rollback() return 0 on success and non-zero value on error and using RETURN_BOOL(result_value) here is obviously wrong.
 [2005-01-27 11:21 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 01 07:03:34 2021 UTC