X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4B52954A51 for ; Wed, 11 May 2005 04:26:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56066-07 for ; Wed, 11 May 2005 07:26:00 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.206]) by svr1.postgresql.org (Postfix) with ESMTP id 9164454A47 for ; Wed, 11 May 2005 04:25:58 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so188671wri for ; Wed, 11 May 2005 00:26:00 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Zw90KtQieVzBNRSYVCIweidYyZC8QYzUPMDJp+rLyh6436V7/YNX81SEcP6Gpqx6qUCgPIFo33M4N+C+Rrf5CRpQJ1glF/5BwLpKNQQPbVXETLRN2oVV1VdXIEkfj6Pj6Iue6urz6vNHXudL286kbinb9LkCcBkRTS3vStBFQKI= Received: by 10.54.141.10 with SMTP id o10mr302642wrd; Wed, 11 May 2005 00:26:00 -0700 (PDT) Received: by 10.54.30.29 with HTTP; Wed, 11 May 2005 00:26:00 -0700 (PDT) Message-ID: <7104a73705051100267625d74@mail.gmail.com> Date: Wed, 11 May 2005 10:26:00 +0300 From: Volkan YAZICI Reply-To: Volkan YAZICI To: pgsql-php@postgresql.org Subject: Fwd: Bug #32904 [Opn->Csd]: pg_get_notify() ignores result_type param. In-Reply-To: <200505102014.j4AKEBwR012267@ez1.php.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200505102014.j4AKEBwR012267@ez1.php.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.328 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200505/23 X-Sequence-Number: 3137 ---------- Forwarded message ---------- From: PHP Bug Database Date: May 10, 2005 11:14 PM Subject: Bug #32904 [Opn->Csd]: pg_get_notify() ignores result_type param. To: volkan.yazici@gmail.com ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=3D32904&edit=3D2 ID: 32904 Updated by: tony2001@php.net Reported By: volkan dot yazici at gmail dot com -Status: Open +Status: Closed Bug Type: PostgreSQL related Operating System: Debian GNU/Linux 3.0 (Unstable) PHP Version: 5.0.3 New Comment: This bug has been fixed in CVS. 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/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2005-05-06 12:55:20] volkan dot yazici at gmail dot com I've tried the CVS snapshot (located at http://snaps.php.net/php5-latest.tar.gz [php5-200505060830]) and the result is same. {{{ Related PHP script: }}} Expected and actual results are same as in the bug report. ------------------------------------------------------------------------ [2005-05-06 03:20:09] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-05-01 17:11:39] volkan dot yazici at gmail dot com :%s/Any of these calls act as/All of these calls act as/g ------------------------------------------------------------------------ [2005-05-01 14:50:24] volkan dot yazici at gmail dot com Description: ------------ Second parameter (result_type) used in pg_get_notify() is ignored. When we look at ext/pgsql/pgsql.c (in revision 1.324, Wed Apr 13 18:11:35 2005 from CVS): Line 49: #define PGSQL_ASSOC 1<<0 Line 50: #define PGSQL_NUM 1<<1 Line 51: #define PGSQL_BOTH (PGSQL_ASSOC|PGSQL_NUM) ... Line 4144: if (result_type & (PGSQL_NUM|PGSQL_BOTH)) { ... Line 4178: if (result_type & (PGSQL_ASSOC|PGSQL_BOTH)) { Both of the if conditions in the lines 4144 and 4178 returns true (positive values) on any input. Thus, result_type param. always acts as PGSQL_BOTH. Line 4144 and 4178 may be replaced by below ones: Line 4144: if (result_type & PGSQL_NUM) { ... Line 4178: if (result_type & PGSQL_ASSOC) { They're working well on my current system. Reproduce code: --------------- /* * Any of these calls act as * var_dump(pg_get_notify($dbconn, PGSQL_BOTH)); */ var_dump(pg_get_notify($dbconn)); var_dump(pg_get_notify($dbconn, PGSQL_NUM)); var_dump(pg_get_notify($dbconn, PGSQL_ASSOC)); Expected result: ---------------- array(4) { ["message"]=3D> string(1) "test" ["pid"]=3D> int(2317) } array(4) { [0]=3D> string(1) "test" [1]=3D> int(2317) } array(4) { ["message"]=3D> string(1) "test" ["pid"]=3D> int(2317) } Actual result: -------------- array(4) { [0]=3D> string(1) "test" [1]=3D> int(2317) ["message"]=3D> string(1) "test" ["pid"]=3D> int(2317) } array(4) { [0]=3D> string(1) "test" [1]=3D> int(2317) ["message"]=3D> string(1) "test" ["pid"]=3D> int(2317) } array(4) { [0]=3D> string(1) "test" [1]=3D> int(2317) ["message"]=3D> string(1) "test" ["pid"]=3D> int(2317) } ------------------------------------------------------------------------