php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #64832 use of "lowest" in `$desiredmsgtype` parameter description creates ambiguity
Submitted: 2013-05-13 19:29 UTC Modified: 2018-09-14 17:43 UTC
From: ww dot galen at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Semaphore related
PHP Version: Irrelevant OS: n/a
Private report: No CVE-ID: None
 [2013-05-13 19:29 UTC] ww dot galen at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.msg-receive#refsect1-function.msg-receive-parameters
---

In the description of the "$desiredmsgtype" parameter, the use of "lowest" is confusing:

    "If desiredmsgtype is less than 0, the first message on the queue with the lowest type less than or equal to the 
absolute value of desiredmsgtype will be read."

"first [...] with the lowest type" could be interpreted to mean that a later message with lower type will be picked over 
an earlier message with higher type. For example, suppose the queue contains the following messages (and types):

  "2.1" (2), "1.1" (1), "2.2" (2), "1.2" (1)

The lowest type is 1, and the first of these messages is 1.1. However, the actual result will be "2.1".

Simply dropping the unneeded "the lowest" will clear things up:

    "If desiredmsgtype is less than 0, the first message on the queue with type less than or equal to the absolute value 
of desiredmsgtype will be read."


Test script:
---------------
<?php
$q = msg_get_queue(0xF00BAA);
msg_send($q, 2, "2.1");
msg_send($q, 1, "1.1");
msg_send($q, 2, "2.2");
msg_send($q, 1, "1.2");

msg_receive($q, -2, $type, strlen(serialize('0.0')), $msg);
echo "msg for -2: $msg ($type)\n";

msg_remove_queue($q);


Expected result:
----------------
msg for -2: 1.1 (1)

Actual result:
--------------
msg for -2: 2.1 (2)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-25 00:27 UTC] philip@php.net
Automatic comment from SVN on behalf of philip
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=330636
Log: Clarified return value as suggested in PHP Bug #64832
 [2013-06-25 00:28 UTC] philip@php.net
Please ignore that SVN update as I entered the wrong bug number.
 [2017-01-28 12:24 UTC] cmb@php.net
-Package: Documentation problem +Package: Semaphore related
 [2018-09-14 17:40 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=345635
Log: Fix #64832: use of &quot;lowest&quot; in `$desiredmsgtype` parameter description creates ambiguity
 [2018-09-14 17:43 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2018-09-14 17:43 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2020-02-07 06:05 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=b3127b7d52bffacb92bf99dd3295fea3a98ebde6
Log: Fix #64832: use of &quot;lowest&quot; in `$desiredmsgtype` parameter description creates ambiguity
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 09:01:29 2024 UTC