php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24932 pg_lo_read_all returns a modified large object from database
Submitted: 2003-08-04 07:27 UTC Modified: 2003-08-09 09:36 UTC
From: leitgebj at barada dot canisius dot edu Assigned:
Status: No Feedback Package: PostgreSQL related
PHP Version: 4.3.2 OS: Mac OS X Darwin Kernel 6.3
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:
38 - 26 = ?
Subscribe to this entry?

 
 [2003-08-04 07:27 UTC] leitgebj at barada dot canisius dot edu
Description:
------------
When a PG large object is returned to the web browser from the database using pg_lo_read_all(db resource, object id) the returned object is modified as shown by the unix command cmp.

bash-2.05a$ cmp kat_y_justin.jpg kat_y_justin_dl.jpg 
kat_y_justin.jpg kat_y_justin_dl.jpg differ: char 1, line 1

File sizes are different but not drastically (between original and downloaded object).  Size is field number 1 below:

30877 Aug  3 14:37 kat_y_justin.jpg
30884 Aug  3 15:15 kat_y_justin_dl.jpg

Reproduce code:
---------------
function send_object() {
   $db = do_db_connect();
   cdb_query($db, "begin");
   $res = pg_lo_open($db, $_POST['object_id'], 'r');
   header("Content-type: " . $_POST['file_type']);
   header("Content-Disposition: file; filename=" .       
           $_POST['filename']);
   header("Content-Transfer-Encoding: binary");
   pg_lo_read_all($res);
   pg_lo_close($res);
   cdb_query($db, "end");
   exit();
}

cdb_query(db resource, string) is just a SQL wrapper function.

Expected result:
----------------
The same large object (which can be retrieved by using command line psql) should be returned to browser.

Actual result:
--------------
A modified file is returned to the browser.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-09 09:36 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 14:01:33 2024 UTC