Doc #64832 [Com]: use of "lowest" in `$desiredmsgtype` parameter description creates ambiguity
| From: | philip@php.net | Date: | Tue, 25 Jun 2013 00:28:00 +0000 |
| Subject: | Doc #64832 [Com]: use of "lowest" in `$desiredmsgtype` parameter description creates ambiguity | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9983@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
Comment by: philip@php.net
Reported by: ww dot galen at gmail dot com
Summary: use of "lowest" in
$desiredmsgtype parameter
description creates ambiguity
Status: Open
Type: Documentation Problem
Package: Documentation problem
Operating System: n/a
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Please ignore that SVN update as I entered the wrong bug number.
Previous Comments:
------------------------------------------------------------------------
[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