#23786 [NEW]: pg_put_line invalidates all active large object resources
| From: | dave at codewhore dot org | Date: | Fri, 23 May 2003 20:55:02 +0000 |
| Subject: | #23786 [NEW]: pg_put_line invalidates all active large object resources | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-40315@lists.php.net to get a copy of this message | ||
From: dave at codewhore dot org
Operating system: Linux 2.4
PHP version: 4CVS-2003-05-23 (stable)
PHP Bug Type: PostgreSQL related
Bug description: pg_put_line invalidates all active large object resources
Hi:
Use of the pg_put_line() function causes most large object operations,
including pg_lo_read and pg_lo_tell, to subsequently fail. A test script
demonstrates this:
<?php
$c = pg_connect('dbname=database user=postgres');
var_dump($c);
var_dump(pg_query($c, 'begin transaction'));
$fd = pg_lo_open($c, $lo_id_goes_here, 'r');
var_dump($fd);
var_dump(pg_query($c, 'copy table_name_goes_here from stdin'));
var_dump(pg_put_line($c, "\\.\n"));
var_dump(pg_end_copy($c));
var_dump(pg_lo_tell($fd));
var_dump(pg_lo_close($fd));
var_dump(pg_query($c, 'commit'));
?>
I would expect to see:
resource(4) of type (pgsql link)
resource(5) of type (pgsql result)
resource(6) of type (pgsql large object)
resource(7) of type (pgsql result)
bool(true)
bool(true)
int(0)
bool(true)
Instead, I get:
resource(4) of type (pgsql link)
resource(5) of type (pgsql result)
resource(6) of type (pgsql large object)
resource(7) of type (pgsql result)
bool(true)
bool(true)
int(-1)
Warning: pg_lo_close(): Unable to close PostgreSQL large object
descriptor 0. in /home/dave/test.php on line 14
bool(false)
The pg_copy_from and pg_copy_to functions, strangely enough, don't exhibit
this behavior.
If this is something intrinsic to the design of Postgres' wire protocol
(e.g. not a PHP bug - I don't know if it is or not), it'd be worth leaving
a nice big warning in the docs for pg_put_line/pg_lo_open.
Thanks in advance,
- Dave
--
Edit bug report at http://bugs.php.net/?id=23786&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23786&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23786&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23786&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23786&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23786&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23786&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23786&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23786&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23786&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23786&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23786&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23786&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23786&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23786&r=gnused