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
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.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Fri Nov 27 18:01:25 2020 UTC