php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68199 PDO::pgsqlGetNotify doesn't support NOTIFY payloads
Submitted: 2014-10-09 12:54 UTC Modified: 2014-10-17 14:17 UTC
From: alain dot laporte12345 at gmail dot com Assigned: mbeccati (profile)
Status: Closed Package: PDO PgSQL
PHP Version: 5.6.2 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alain dot laporte12345 at gmail dot com
New email:
PHP Version: OS:

 

 [2014-10-09 12:54 UTC] alain dot laporte12345 at gmail dot com
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)
}


Patches

payload_support (last revision 2014-10-09 12:54 UTC by alain dot laporte12345 at gmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-17 13:22 UTC] tyrael@php.net
-Assigned To: +Assigned To: mbeccati
 [2014-10-17 13:22 UTC] tyrael@php.net
Matteo, any chance you could look into this?
 [2014-10-17 13:44 UTC] mbeccati@php.net
Thanks for reporting. I would actually categorize this as a bug, as I've mistakenly left it out when adding pgsqlGetNotify in 5.6.0. I guess it would be safe to try and fix it for 5.6.2 and accordingly update the manual entry. Thoughts?
 [2014-10-17 13:49 UTC] tyrael@php.net
5.6.2 is already out, but I would be okay to have it fixed in the PHP-5.6 branch (so fixing it in 5.6.3 for example).
 [2014-10-17 14:17 UTC] mbeccati@php.net
-Summary: Payload in NOTIFY is not supported +Summary: PDO::pgsqlGetNotify doesn't support NOTIFY payloads -Type: Feature/Change Request +Type: Bug -Operating System: Linux (ArchLinux) +Operating System: -PHP Version: 5.6.1 +PHP Version: 5.6.2
 [2014-10-17 14:49 UTC] mbeccati@php.net
Automatic comment on behalf of mbeccati
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8c5e2e66bcbb6fa24db6515a09be36bb4bbf0860
Log: Fixed bug #68199 (PDO::pgsqlGetNotify doesn't support NOTIFY payloads)
 [2014-10-17 14:49 UTC] mbeccati@php.net
-Status: Assigned +Status: Closed
 [2014-10-24 20:29 UTC] ab@php.net
Automatic comment on behalf of mbeccati
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8c5e2e66bcbb6fa24db6515a09be36bb4bbf0860
Log: Fixed bug #68199 (PDO::pgsqlGetNotify doesn't support NOTIFY payloads)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC