php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #63342 Undefined constant AMQP_NOACK
Submitted: 2012-10-23 21:14 UTC Modified: 2014-12-27 22:22 UTC
Votes:3
Avg. Score:4.3 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: andre dot torgal at gmail dot com Assigned: pdezwart (profile)
Status: Closed Package: amqp (PECL)
PHP Version: 5.3.18 OS: Linux Ubuntu 2.6.32 32bit
Private report: No CVE-ID: None
 [2012-10-23 21:14 UTC] andre dot torgal at gmail dot com
Description:
------------
Trying to use AMQP_NOACK on AMQPQueue::consume($callback, [int $flags]) complains 
about undefined constants.

pecl/amqp is already installed and is the same as the released version 1.0.7

Using protocol version => 0-9-1

Meanwhile I found out - by using get_declared_constants() - that the current name 
for this constant should be AMQP_AUTOACK, which actually makes more sense and 
matches the amqp ini var: amqp.auto_ack => 0 => 0




Test script:
---------------
$exchangeName = 'DirectExchange';
$queueName = 'Process';
$routingKey = 'This';

// connect
$connection = new AMQPConnection();
$channel = new AMQPChannel($connection);

// configure and declare an exchange
$exchange = new \AMQPExchange($channel);
$exchange->setType(AMQP_EX_TYPE_DIRECT);
$exchange->setName($exchangeName);
$exchange->setFlags(AMQP_DURABLE);
$exchange->declare();

// configure and declare a queue
$queue = new \AMQPQueue($channel);
$queue->setName($queueName);
$queue->setFlags(AMQP_DURABLE);
$queue->declare();

$queue->consume($callback, AMQP_AUTOACK)

Expected result:
----------------
Consume is executed and registered callback is triggered

Actual result:
--------------
PHP Notice:  Use of undefined constant AMQP_NOACK - assumed 'AMQP_NOACK'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-23 22:56 UTC] philip@php.net
-Status: Open +Status: Verified
 [2012-10-23 22:56 UTC] philip@php.net
It appears AMQP_NOACK was removed and replaced with AMQP_AUTOACK as of 1.0.0 of 
this extension, and that the  AMQPQueue::consume() documentation still refers to 
the old constant.

Proper fix: add a changelog entry that mentions this change (where? it's not 
specific to a method, but one location is fine), and replace AMQP_NOACK with 
AMQP_AUTOACK in the documentation. Steal the flags parameter description from 
another method.
 [2012-11-06 02:59 UTC] philip@php.net
-Assigned To: +Assigned To: pdezwart
 [2012-11-14 00:41 UTC] bkw at codingforce dot com
Thanks for reporting. The documentation is out of date unfortunately. Work is 
underway to remedy this.
 [2014-12-27 22:22 UTC] sobak@php.net
-Status: Verified +Status: Closed
 [2014-12-27 22:22 UTC] sobak@php.net
AMQP documentation is no longer a part of php.net manual.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Jun 21 10:01:24 2021 UTC