Req #68199 [NEW]: Payload in NOTIFY is not supported

From: Date: Thu, 09 Oct 2014 12:54:21 +0000
Subject: Req #68199 [NEW]: Payload in NOTIFY is not supported
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187984@lists.php.net to get a copy of this message
From:             alain dot laporte12345 at gmail dot com
Operating system: Linux (ArchLinux)
PHP version:      5.6.1
Package:          PDO PgSQL
Bug Type:         Feature/Change Request
Bug description:Payload in NOTIFY is not supported

Description:
------------
Since PostgreSQL 9.0, NOTIFY command accept a payload =>
http://www.postgresql.org/docs/9.0/static/sql-notify.html

The payload is available in the libpq's structure pgNotify.extra =>
http://www.postgresql.org/docs/9.0/static/libpq-notify.html

This field is available since PostgreSQL 7.4, but is empty until
PostgreSQL 9.0 =>
http://www.postgresql.org/docs/7.4/static/libpq-notify.html

I provide a patch for PDO::pgsqlGetNotify() method which work for me.
But I doubt which my check about libpq version is comply with the good
practice.

Test script:
---------------
<?php
$dsn =
'pgsql:host=localhost;port=5432;dbname=postgres;user=admin;password=toto';
$db = new PDO($dsn);

$db->exec('LISTEN event;');
$db->exec('NOTIFY event, \'payload\';');
var_dump($db->pgsqlGetNotify());
?>

Expected result:
----------------
array(6) {
  [0]=>
  string(5) "event"
  [1]=>
  int(25876)
  [2]=>
  string(7) "payload"
  ["message"]=>
  string(5) "event"
  ["pid"]=>
  int(25876)
  ["payload"]=>
  string(7) "payload"
}


Actual result:
--------------
array(4) {
  [0]=>
  string(5) "event"
  [1]=>
  int(25876)
  ["message"]=>
  string(5) "event"
  ["pid"]=>
  int(25876)
}


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



Thread (5 messages)

« previous php.bugs (#187984) next »