symfony: Undefined constant AMQP_NOPARAM in AmqpStamp
Symfony version(s) affected
6.3.12
Description
I just tried to use this package symfony/amqp-messenger@6.3.12
last night and today noticed that I am receiving this exception:
"message": "Uncaught PHP Exception Error: \"Undefined constant \"AMQP_NOPARAM\"\" at /var/www/html/modeer-web-app/vendor/symfony/amqp-messenger/Transport/AmqpStamp.php line 27",
"context": {
"exception": {
"class": "Error",
"message": "Undefined constant \"AMQP_NOPARAM\"",
"code": 0,
"file": "/var/www/html/modeer-web-app/vendor/symfony/amqp-messenger/Transport/AmqpStamp.php:27"
}
},
"level": 500,
"level_name": "CRITICAL",
"channel": "request",
"datetime": "2024-04-20T17:02:33.166481+04:30",
"extra": {}
}
And when I search for the definition of the constant AMQP_NOPARAM
in vendor/symfony/amqp-messenger
, it seems it is not defined. To do a workaround I created this file at scripts/amqp-constants.php
:
<?php
if (!defined('AMQP_NOPARAM')) {
define('AMQP_NOPARAM', 0);
}
and added the following to composer.json
:
"autoload": {
"files": ["scripts/amqp-constants.php"],
But it does not really look the right thing for me, I must have been missing something or is it a bug?
How to reproduce
I mentioned all the code above.
Possible Solution
I added my workaround above, maybe it could also be moved to the repo itself?
Additional Context
No response
About this issue
- Original URL
- State: closed
- Created 2 months ago
- Comments: 18 (9 by maintainers)
I think he meant you should access it via web SAPI (via browser, curl, …) instead of CLI SAPI.
What is the output of this script when you access it over your web server?
Ubuntu ships the old v1 of the extension. I suspect that v1 does not have the constant (which is just an alias for zero anyway). So the fix might be that we’re using
0
instead of the constant in Symfony.