begin-transaction in pdo:sqlite

Found a bug? Tell us!!
Post Reply
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

begin-transaction in pdo:sqlite

Post by onli »

The bayes-plugin calls serendipity_db_begin_transaction() when creating the database. When using PDO:sqlite, this leads to an error:

Code: Select all

PHP Fatal error:  Call to a member function beginTransaction() on a non-object in /var/www/include/db/pdo-sqlite.inc.php on line 52
That is this ine:

Code: Select all

function serendipity_db_begin_transaction(){
    $serendipity['dbConn']->beginTransaction();
}
I don't see how $serendipity['dbConn'] could not be initialised at this point. How to fix this?
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: begin-transaction in pdo:sqlite

Post by Timbalu »

how about a global $serendipity; ? :wink:

function serendipity_db_end_transaction($commit){

needs that too!
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: begin-transaction in pdo:sqlite

Post by onli »

That's not my code.
If that is the bug, mysql would have the same bug and the plugin never should've worked.

Edit: Or not. Mysql uses dbquery for calling that command, where global $serendipity is set.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: begin-transaction in pdo:sqlite

Post by Timbalu »

Indeed!
I think no one did use this ever, thats why nobody complained! :wink:

Give it a try. I bet its the missing global!
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: begin-transaction in pdo:sqlite

Post by Timbalu »

oh yes, sure, not mysql.

It looks generally like a copy & paste error in most of these db files
A quick overview greps postgres, sqlite, pdo-postgres, pdo-sqlite, sqlite3 to be affected!

Edit:
only pdo-postgres and pdo-sqlite
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: begin-transaction in pdo:sqlite

Post by onli »

True, ading global $serendipity fixes the bug.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: begin-transaction in pdo:sqlite

Post by Timbalu »

Do you want to add this to trunk and 1.6.1, or shall we leave this to Garvin?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: begin-transaction in pdo:sqlite

Post by onli »

I already commited it to trunk, but i'd prefer not to touch 1.6. Feel free to ;)
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: begin-transaction in pdo:sqlite

Post by Timbalu »

I do not actually know how, thats why I don't like to touch the 1.6 branch too, ...
maybe Grischa can write some more info to the wiki...?! :wink:
Last edited by Timbalu on Sun Feb 05, 2012 7:48 pm, edited 1 time in total.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: begin-transaction in pdo:sqlite

Post by Timbalu »

@Garvin
If this update may spit out the 1.6.1 revision, we should think of backporting at least the token thing too. (And "maybe" 2k11 needs to wait for a soon released Boilerplate 3.0, with updated modernizer etc)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Post Reply