|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35245 mysql_query not working when ob-Start() is called before
Submitted: 2005-11-16 19:23 UTC Modified: 2005-11-24 01:00 UTC
Avg. Score:4.0 ± 1.0
Reproduced:0 of 0 (0.0%)
From: walkekev at gmail dot com Assigned:
Status: No Feedback Package: MySQL related
PHP Version: 4.4.1 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-11-16 19:23 UTC] walkekev at gmail dot com
The script will not do my sql statement if the ob_start() is called before my sql statement

Reproduce code:
<?php // first page of code
$name = basename($_FILES['userfile']['name']);
	$filename = $_FILES['userfile']['tmp_name'];
	$data = file_get_contents($filename);
	$filedata = mysql_real_escape_string($data);
	list($width, $height) = getimagesize($filename);
	$sql = "INSERT INTO `pictures` ( `id` , `name` , `height` , `width` , `type` , `data` ) VALUES ( '', '$name', '$height', '$width', 'a', '$filedata')";
 	$sql = "INSERT INTO `pictures` ( `id` , `name` , `height` , `width` , `type` , `data` ) VALUES ( '', '$name', '$newheight', '$newwidth', 'b', '$filedata')";
<?php // this is obufthumb.php
if($height > $width){
	$newheight = '120';
	$newwidth = '120' / $height * $width;
	$newwidth = '120';
	$newheight = '120' / $width * $height;
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($thumb, NULL, 100);
$filedata = ob_get_contents();

Expected result:
is should insert 2 images into the database, one that is no more then 120px wide or tall.

Actual result:
it only inserts one into the database, the first one, with type a.

when i remove the ob_start() and ob_end_clean() it will work, both wil be inserted, but all the code of the jpeg is inserted into my screen


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-16 19:24 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.

 [2005-11-16 19:57 UTC] walkekev at gmail dot com
the script is availbe to view here
 [2005-11-16 20:04 UTC]
Please provide a *SHORT* but complete reproduce script, that is max. 10-20 line long.
 [2005-11-24 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Mar 02 14:01:34 2024 UTC