Bug #52682 [Fbk->NoF]: pg_query does not return on error

From: Date: Mon, 18 Feb 2013 00:34:26 +0000
Subject: Bug #52682 [Fbk->NoF]: pg_query does not return on error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-176897@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=52682&edit=1

 ID:               52682
 Updated by:       php-bugs@lists.php.net
 Reported by:      benoitg at coeus dot ca
 Summary:          pg_query does not return on error
-Status:           Feedback
+Status:           No Feedback
 Type:             Bug
 Package:          PostgreSQL related
 Operating System: Ubuntu Lucid or Maverick
 PHP Version:      5.3.3

 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:
------------------------------------------------------------------------
[2010-10-20 13:21:34] jr at jr dot pl

I have the same on Ubuntu 
Linux  2.6.35-22-server #35-Ubuntu SMP x86_64 GNU/Linux
and PHP version 5.3.3-1ubuntu9 

that works fine on PHP 5.3.2-1ubuntu4.5

------------------------------------------------------------------------
[2010-10-19 17:23:20] Dalifter2006 at mail dot ru

php --version
PHP 5.3.3-1ubuntu9 with Suhosin-Patch (cli) (built: Sep 20 2010 22:40:29) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

Catched up on selection from not-exists table.

------------------------------------------------------------------------
[2010-09-20 14:32:45] iliaa@php.net

Seems to work fine in latest snapshot.

------------------------------------------------------------------------
[2010-08-25 23:17:52] benoitg at coeus dot ca

Additional notes:

When the bug occurs, lines like the following are written to the postgresql log:
2010-08-25 17:03:03 EDT LOG:  unexpected EOF on client connection

No errors are reported by apache.

------------------------------------------------------------------------
[2010-08-24 00:52:50] benoitg at coeus dot ca

Description:
------------
pg_query() should return when an SQL error happens (there are then various function to get the error
description.  However in php 5.3.2 (ubuntu lucid) and 5.3.3 (ubuntu maverick), the function
doesn't return at all (the php script ends).

Included is a short test script.  As will run on ubuntu as written if you run php cli as the
postgres system user, for example:

sudo -u postgres php test_pg_query_not_returning.php

Test script:
---------------
<?php

define ('CONF_DATABASE_NAME', "postgres");
define ('CONF_DATABASE_USER', "postgres");
define ('CONF_DATABASE_PASSWORD', "");
$conn_string = "dbname=".CONF_DATABASE_NAME." user=".CONF_DATABASE_USER."
password=".CONF_DATABASE_PASSWORD."\n";
$conn = pg_connect($conn_string) or die("Unable to connect to database, fix this first");

echo "About to execute actual test: \n";
$sql = "SOME INVALID SQL";
$return = pg_query($conn, $sql);

if($return === FALSE) {
        echo "You should see this, but this code is never executed!\n";
}

echo "Even this code is never executed!\n";
?>


Expected result:
----------------
sudo -u postgres php test_pg_query_not_returning.php 
About to execute actual test: 
PHP Warning:  pg_query(): Query failed: ERROR:  syntax error at or near "SOME"
LINE 1: SOME INVALID SQL
        ^
 in /var/www/eureka/html/tests/test_pg_query_not_returning.php on line 11
You should see this, but this code is never executed!
Even this code is never executed!

Actual result:
--------------
sudo -u postgres php test_pg_query_not_returning.php 
About to execute actual test: 
PHP Warning:  pg_query(): Query failed: ERROR:  syntax error at or near "SOME"
LINE 1: SOME INVALID SQL
        ^
 in /var/www/eureka/html/tests/test_pg_query_not_returning.php on line 11



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=52682&edit=1


Thread (6 messages)

« previous php.bugs (#176897) next »