ID:               24932
 Updated by:       [EMAIL PROTECTED]
 Reported By:      leitgebj at barada dot canisius dot edu
-Status:           Open
+Status:           Feedback
 Bug Type:         PostgreSQL related
 Operating System: Mac OS X Darwin Kernel 6.3
 PHP Version:      4.3.2
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip


Previous Comments:
------------------------------------------------------------------------

[2003-08-04 07:27:34] 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.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=24932&edit=1

Reply via email to