From: leitgebj at barada dot canisius dot edu Operating system: Mac OS X Darwin Kernel 6.3 PHP version: 4.3.2 PHP Bug Type: PostgreSQL related Bug description: pg_lo_read_all returns a modified large object from database
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 bug report at http://bugs.php.net/?id=24932&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24932&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24932&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=24932&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24932&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24932&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24932&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24932&r=support Expected behavior: http://bugs.php.net/fix.php?id=24932&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24932&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24932&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24932&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24932&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24932&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24932&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24932&r=gnused