tony2001                Tue May 10 19:12:33 2005 EDT

  Modified files:              
    /php-src/ext/pgsql  pgsql.c 
  Log:
  use & and check for the right value of result_type
  
  
http://cvs.php.net/diff.php/php-src/ext/pgsql/pgsql.c?r1=1.326&r2=1.327&ty=u
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.326 php-src/ext/pgsql/pgsql.c:1.327
--- php-src/ext/pgsql/pgsql.c:1.326     Tue May 10 16:13:24 2005
+++ php-src/ext/pgsql/pgsql.c   Tue May 10 19:12:31 2005
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
  
-/* $Id: pgsql.c,v 1.326 2005/05/10 20:13:24 tony2001 Exp $ */
+/* $Id: pgsql.c,v 1.327 2005/05/10 23:12:31 tony2001 Exp $ */
 
 #include <stdlib.h>
 
@@ -4137,6 +4137,11 @@
 
        ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL 
link", le_link, le_plink);
 
+       if (!(result_type & PGSQL_BOTH)) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid result 
type");
+               RETURN_FALSE;
+       }
+
        PQconsumeInput(pgsql);
        pgsql_notify = PQnotifies(pgsql);
        if (!pgsql_notify) {
@@ -4144,11 +4149,11 @@
                RETURN_FALSE;
        }
        array_init(return_value);
-       if (result_type == PGSQL_NUM || result_type == PGSQL_BOTH) {
+       if (result_type & PGSQL_NUM) {
                add_index_string(return_value, 0, pgsql_notify->relname, 1);
                add_index_long(return_value, 1, pgsql_notify->be_pid);
        }
-       if (result_type == PGSQL_ASSOC || result_type == PGSQL_BOTH) {
+       if (result_type & PGSQL_ASSOC) {
                add_assoc_string(return_value, "message", 
pgsql_notify->relname, 1);
                add_assoc_long(return_value, "pid", pgsql_notify->be_pid);
        }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to