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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
27 - 10 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 17:01:31 2024 UTC