tony2001                Tue May 10 19:15:24 2005 EDT

  Modified files:              (Branch: PHP_5_0)
    /php-src    NEWS 
    /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/NEWS?r1=1.1760.2.380&r2=1.1760.2.381&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1760.2.380 php-src/NEWS:1.1760.2.381
--- php-src/NEWS:1.1760.2.380   Tue May 10 17:45:25 2005
+++ php-src/NEWS        Tue May 10 19:15:23 2005
@@ -16,7 +16,7 @@
 - Fixed bug #32936 (http redirects URLs are not checked for control chars). 
(Ilia)
 - Fixed bug #32932 (Oracle LDAP: ldap_get_entries(), invalid pointer). (Jani)
 - Fixed bug #32930 (class extending DOMDocument doesn't clone properly). (Rob)
-- Fixed bug #32904 (pg_get_notify() ignores result_type parameter). (Antony)
+- Fixed bug #32904 (pg_get_notify() ignores result_type parameter). (Tony)
 - Fixed bug #32852 (Crash with singleton and __destruct when
   zend.ze1_compatibility_mode = On). (Dmitry)
 - Fixed bug #32813 (parse_url() does not handle scheme-only urls properly). 
(Ilia)
http://cvs.php.net/diff.php/php-src/ext/pgsql/pgsql.c?r1=1.311.2.3&r2=1.311.2.4&ty=u
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.311.2.3 php-src/ext/pgsql/pgsql.c:1.311.2.4
--- php-src/ext/pgsql/pgsql.c:1.311.2.3 Tue May 10 16:13:57 2005
+++ php-src/ext/pgsql/pgsql.c   Tue May 10 19:15:24 2005
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
  
-/* $Id: pgsql.c,v 1.311.2.3 2005/05/10 20:13:57 tony2001 Exp $ */
+/* $Id: pgsql.c,v 1.311.2.4 2005/05/10 23:15:24 tony2001 Exp $ */
 
 #include <stdlib.h>
 
@@ -3274,6 +3274,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);
@@ -3282,11 +3287,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