php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62000 sqlite3 db in ob_start callback fails
Submitted: 2012-05-10 21:43 UTC Modified: 2014-11-19 09:18 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: sicommnend at gmail dot com Assigned:
Status: Wont fix Package: SQLite related
PHP Version: 5.3.6 OS: Linux
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 — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
41 - 1 = ?
Subscribe to this entry?

 
 [2012-05-10 21:43 UTC] sicommnend at gmail dot com
Description:
------------
If you connect to a SQLite3 database in the ob_start callback function then the 
script exits without any output and the database doesn't get written to.

In the test script if you move the SQLite3 database code out of the callback 
function the script works, however it fails if there is any connection to a 
SQLite3 database withing the callback function.

Test script:
---------------
<?php
ob_start('callbackfunc');
echo 'test test test test test test test test test ';
function callbackfunc($buffer) {

	return $buffer;
}

	$DB = new SQLite3('db');
	$DB->exec('CREATE TABLE test (one int, two text);');
	$DB->exec('INSERT INTO test VALUES (10, \'some text\')');
?>

Expected result:
----------------
The database gets written to and the output gets sent.

Actual result:
--------------
Script exits with no output and database is not created.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-10 21:45 UTC] sicommnend at gmail dot com
The test script I posted above will suceed, this is the one that will fail. Got 
my testing scripts mixed up there.

<?php
ob_start('callbackfunc');
echo 'test test test test test test test test test ';
function callbackfunc($buffer) {
	$DB = new SQLite3('db');
	$DB->exec('CREATE TABLE test (one int, two text);');
	$DB->exec('INSERT INTO test VALUES (10, \'some text\')');
	return $buffer;
}
?>
 [2012-05-12 02:58 UTC] sicommnend at gmail dot com
-Operating System: +Operating System: Linux -PHP Version: 5.4.3 +PHP Version: 5.3
 [2012-05-12 02:58 UTC] sicommnend at gmail dot com
Wrong PHP version meant 5.3
 [2012-05-12 03:03 UTC] sicommnend at gmail dot com
-PHP Version: 5.3 +PHP Version: 5.3.6
 [2012-05-12 03:03 UTC] sicommnend at gmail dot com
Edited version to be more exact.
 [2012-05-12 20:36 UTC] sicommnend at gmail dot com
SQLite Library	3.7.4
SQLite Library	2.8.17

SQLite versions, just tested on SQLite 2 and same problem.

I notice in SQLite 2 if I use the procedural programming method the output is 
returned of the output buffer but no database activity.

However if I use the OOP method I get no output, no error, or no database 
activity.

In either method though, the SQLite database is still unreachable.
 [2014-11-19 09:18 UTC] mike@php.net
-Status: Open +Status: Wont fix
 [2014-11-19 09:18 UTC] mike@php.net
5.3 is dead, sorry.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC