ID: 22306 Updated by: [EMAIL PROTECTED] Reported By: php at codewhore dot org -Status: Open +Status: Closed Bug Type: PostgreSQL related Operating System: Linux 2.4 PHP Version: 4.3.0 New Comment:
This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Thanks for the excellent analysis. :) Previous Comments: ------------------------------------------------------------------------ [2003-02-19 16:51:23] php at codewhore dot org >From ext/pgsql/pgsql.c: if (lo_lseek((PGconn *)pgsql->conn, pgsql->lofd, offset, whence )) { RETURN_TRUE; } else { RETURN_FALSE; } If lo_lseek() is anything like the POSIX lseek(), shouldn't the above return false when the return value is -1, not zero? ------------------------------------------------------------------------ [2003-02-19 16:07:22] php at codewhore dot org Seeking back to the beginning of a file on a PostgreSQL large object handle returns false, even though the seek succeeds. The following script: <?php $database = pg_connect ('dbname=pile_dev user=postgres'); pg_exec ($database, 'begin transaction'); $oid = pg_lo_create($database); $handle = pg_lo_open($database, $oid, "rw"); echo 'write: '; var_dump(pg_lo_write($handle, 'foo')); echo 'tell: '; var_dump(pg_lo_tell($handle)); echo 'seek to begin: '; var_dump(pg_lo_seek($handle, 0, PGSQL_SEEK_SET)); echo 'tell: '; var_dump(pg_lo_tell($handle)); pg_exec($database, 'commit'); pg_close($database); ?> outputs: write: int(3) tell: int(3) seek to begin: bool(false) tell: int(0) I expected: write: int(3) tell: int(3) seek to begin: bool(true) tell: int(0) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22306&edit=1