php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53818 Missing info in pg_get_notify function
Submitted: 2011-01-22 19:32 UTC Modified: 2012-01-11 09:44 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: r dot i dot k at free dot fr Assigned: iliaa (profile)
Status: Closed Package: PostgreSQL related
PHP Version: 5.3.8 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: r dot i dot k at free dot fr
New email:
PHP Version: OS:

 

 [2011-01-22 19:32 UTC] r dot i dot k at free dot fr
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)

Patches

pgsql_notify_payload.patch (last revision 2011-01-22 18:33 UTC by r dot i dot k at free dot fr)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-27 17:02 UTC] iliaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: iliaa
 [2011-01-27 17:02 UTC] iliaa@php.net
This bug has been fixed in SVN.

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.


 [2011-10-14 06:06 UTC] timosha at gmail dot com
Please backport this patch to 5.3.x. :)
 [2011-10-15 16:19 UTC] r dot i dot k at free dot fr
-Status: Closed +Status: Assigned -PHP Version: 5.2.17 +PHP Version: 5.3.8
 [2011-10-15 16:19 UTC] r dot i dot k at free dot fr
The provided patch, 9 months ago, is still missing from 5.3 branch...
It would be cool to have it pushed in official source code, since it still works (made for 5.2.17, applyable to 5.3.8), and give access to a feature appeared in PostgreSQL 14 months ago :(((
 [2012-01-11 08:50 UTC] timosha at gmail dot com
hmm, seems that this patch applied for php-5.3.9 but no info in changelog
 [2012-01-11 09:44 UTC] r dot i dot k at free dot fr
I confirm that the current patch has been applied to PHP 5.3.9
Just disappointed to have waited for quite a year, for such a full working patch integration.

This situation does not tempt me to contribute anymore... 

Bug CLOSED.
 [2012-01-11 09:44 UTC] r dot i dot k at free dot fr
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC