Bug #81533 [NEW]: mysqli_rollback() returns TRUE if there's no active transaction

From: Date: Sun, 17 Oct 2021 21:01:46 +0000
Subject: Bug #81533 [NEW]: mysqli_rollback() returns TRUE if there's no active transaction
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237246@lists.php.net to get a copy of this message
From:             morozov at tut dot by
Operating system: Linux
PHP version:      8.1.0RC4
Package:          MySQLi related
Bug Type:         Bug
Bug description:mysqli_rollback() returns TRUE if there's no active transaction

Description:
------------
mysqli_rollback() called on a fresh connection (while autocommit is ON)
returns TRUE, although there's no active transaction. This contradicts
the documentation which states:
> Returns true on success or false on failure.

It's also inconsistent with pdo_mysql which reports such an attempt as
invalid:

<?php

(new PDO('mysql:host=127.0.0.1;dbname=mysql', 'root',
''))->rollback();
// PDOException: There is no active transaction

Test script:
---------------
var_dump(mysqli_connect('127.0.0.1', 'root', '',
'mysql')->rollback());


Expected result:
----------------
bool(false)

Actual result:
--------------
bool(true)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=81533&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81533&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81533&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81533&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81533&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81533&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81533&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81533&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81533&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81533&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81533&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81533&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81533&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81533&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81533&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81533&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81533&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81533&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#237246) next »