#24932 [Fbk->NoF]: pg_lo_read_all returns a modified large object from database
ID: 24932
Updated by: sniper@php.net
Reported By: leitgebj at barada dot canisius dot edu
-Status: Feedback
+Status: No Feedback
Bug Type: PostgreSQL related
Operating System: Mac OS X Darwin Kernel 6.3
PHP Version: 4.3.2
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2003-08-04 10:58:24] sniper@php.net
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
------------------------------------------------------------------------
[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
Thread (3 messages)