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 F1802535CB for ; Sun, 1 May 2005 10:59:04 -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 75996-08 for ; Sun, 1 May 2005 13:58:57 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) by svr1.postgresql.org (Postfix) with ESMTP id B729E533AA for ; Sun, 1 May 2005 10:58:56 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so1336075wri for ; Sun, 01 May 2005 06:59:01 -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=JT9efnv8vqsLL97FGSRRJ+7JvQEYswh9u7QaHhdqYJrs/qDZa24TWYKO9qk8YsvRMEG9p5JKT27KOZ1xRHuOHttUOODdV0TUE1DPAqv/QG/vVba/0hMGU1Mdc+YqIOqtTNfAqeN+erfKbvP1N3t/nAs3lT3RkhiK2ZsYvwrRJqw= Received: by 10.54.122.11 with SMTP id u11mr134495wrc; Sun, 01 May 2005 06:59:01 -0700 (PDT) Received: by 10.54.30.31 with HTTP; Sun, 1 May 2005 06:59:01 -0700 (PDT) Message-ID: <7104a73705050106596dee2573@mail.gmail.com> Date: Sun, 1 May 2005 16:59:01 +0300 From: Volkan YAZICI Reply-To: Volkan YAZICI To: pgsql-php@postgresql.org Subject: Fwd: Bug #32904: pg_get_notify() ignores result_type param. In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.299 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200505/1 X-Sequence-Number: 3115 From: PHP Bug Database Date: May 1, 2005 3:50 PM Subject: Bug #32904: pg_get_notify() ignores result_type param. To: volkan.yazici@gmail.com From: volkan dot yazici at gmail dot com Operating system: Debian GNU/Linux 3.0 (Unstable) PHP version: 5.0.3 PHP Bug Type: PostgreSQL related Bug description: pg_get_notify() ignores result_type param. 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) }