php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #72196 Wrong documantation
Submitted: 2016-05-11 12:41 UTC Modified: 2016-05-11 13:38 UTC
From: k dot warnke at gmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 7.0.6 OS: Windows 7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: k dot warnke at gmail dot com
New email:
PHP Version: OS:

 

 [2016-05-11 12:41 UTC] k dot warnke at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/pdo.intransaction
---
It looks like that inTransaction() is not a PDO class static method.
It I use it as proposed

POD::inTransaction()

I get this error:

Fatal error: Uncaught Error: Non-static method PDO::inTransaction() cannot be called statically 

If I change it to 

        $db = new PDO(DB_DSN, DB_USER, DB_PASS, DB_OPT);
...
        if ($db->inTransaction())
        {
            $db->rollBack();
        }

it works.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-05-11 13:38 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2016-05-11 13:38 UTC] requinix@php.net
The documentation does not say it is static.

If you're looking at the Description, the "::" does not mean static. (It is not, in fact, a "static method call" operator in the first place.) That is the syntax used within the manual to show that inTransaction is a method of the PDO class. Consider that "PDO->inTransaction" would not be any better.

If it was static the description would say "static". See PDO::getAvailableDrivers() <http://php.net/manual/en/pdo.getavailabledrivers.php> for an example of that.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 20:01:34 2025 UTC