Check the return value of lo_export.
authorAdam Harvey <aharvey@php.net>
Tue, 30 Dec 2014 17:47:19 +0000 (17:47 +0000)
committerAdam Harvey <aharvey@php.net>
Tue, 30 Dec 2014 17:47:19 +0000 (17:47 +0000)
Patch by Ondřej Surý. Fixes bug #68697 (lo_export return -1 on failure).

NEWS
ext/pgsql/pgsql.c

diff --git a/NEWS b/NEWS
index 9b2fd10b8fd4cab27496762e0d85729137aa9854..f91a555d14e2132562c881d75b7f7d149f3a6311 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -47,6 +47,9 @@ PHP                                                                        NEWS
   . Fixed bug #66679 (Alignment Bug in PCRE 8.34 upstream).
     (Rainer Jung, Anatol Belski)
 
+- pgsql:
+  . Fixed bug #68697 (lo_export return -1 on failure). (Ondřej Surý)
+
 - PDO_mysql
   . Fixed bug #68424 (Add new PDO mysql connection attr to control multi
     statements option). (peter dot wolanin at acquia dot com)
index e2b417ea2c698f2f626c5b5045fce609aeedbb84..e60d420f96730cf1f50326825ac421cda903b7a2 100644 (file)
@@ -3631,10 +3631,10 @@ PHP_FUNCTION(pg_lo_export)
 
        ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
 
-       if (lo_export(pgsql, oid, file_out)) {
-               RETURN_TRUE;
+       if (lo_export(pgsql, oid, file_out) == -1) {
+               RETURN_FALSE;
        }
-       RETURN_FALSE;
+       RETURN_TRUE;
 }
 /* }}} */