Doc #64832 [Opn->Csd]: use of "lowest" in `$desiredmsgtype` parameter description creates ambiguity
| From: | cmb@php.net | Date: | Fri, 14 Sep 2018 17:43:50 +0000 |
| Subject: | Doc #64832 [Opn->Csd]: use of "lowest" in `$desiredmsgtype` parameter description creates ambiguity | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-15996@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64832&edit=1
ID: 64832
Updated by: cmb@php.net
Reported by: ww dot galen at gmail dot com
Summary: use of "lowest" in
$desiredmsgtype parameter
description creates ambiguity
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Semaphore related
Operating System: n/a
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2018-09-14 17:40:50] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=345635
Log: Fix #64832: use of "lowest" in $desiredmsgtype parameter
description creates ambiguity
------------------------------------------------------------------------
[2013-06-25 00:28:43] philip@php.net
Related To: Bug #64801
------------------------------------------------------------------------
[2013-06-25 00:28:00] philip@php.net
Please ignore that SVN update as I entered the wrong bug number.
------------------------------------------------------------------------
[2013-06-25 00:27:11] philip@php.net
Automatic comment from SVN on behalf of philip
Revision: http://svn.php.net/viewvc/?view=revision&revision=330636
Log: Clarified return value as suggested in PHP Bug #64832
------------------------------------------------------------------------
[2013-05-13 19:29:00] 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)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64832&edit=1