Bug #53818 [NEW]: Missing info in pg_get_notify function

From: Date: Sat, 22 Jan 2011 18:32:25 +0000
Subject: Bug #53818 [NEW]: Missing info in pg_get_notify function
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-158086@lists.php.net to get a copy of this message
From:             
Operating system: Linux
PHP version:      5.2.17
Package:          PostgreSQL related
Bug Type:         Bug
Bug description:Missing info in pg_get_notify function

Description:
------------
Since Postgresql 9.0, event notifications fired by the NOTIFY sql command
includes a payload (a 8000 bytes max piece of text).

As of now, the PHP function pg_get_notify only retrieve the "channel" (name
of the notification) and the backend pid.

The attached patch improves this situation by adding the payload to the
returned array of the pg_get_notify function, when the connected PG backend
version is at least 9.0.

Hope it helps...

Test script:
---------------
$dbconn = pg_connect(...) ; // To be completed

pg_query($dbconn, "LISTEN toto");
pg_query($dbconn, "NOTIFY toto, 'Hello world !'");

$notify = pg_get_notify($dbconn, PGSQL_ASSOC) ;

print_r($notify) ;


Expected result:
----------------
// Array("message" => "toto", "pid" => 12345,
"payload" => "Hello world !")

Actual result:
--------------
// Array("message" => "toto", "pid" => 12345)

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53818&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=53818&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=53818&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=53818&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=53818&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53818&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=53818&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=53818&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=53818&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=53818&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=53818&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=53818&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=53818&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=53818&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=53818&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53818&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53818&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=53818&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=53818&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=53818&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=53818&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=53818&r=mysqlcfg



Thread (6 messages)

« previous php.bugs (#158086) next »