Page MenuHomePhabricator (Chris)

No OneTemporary

Size
6 KB
Referenced Files
None
Subscribers
None
diff --git a/debian/patches/0001-Use-php_format_date-instead-of-php_std_date.patch b/debian/patches/0001-Use-php_format_date-instead-of-php_std_date.patch
new file mode 100644
index 0000000..b4f7571
--- /dev/null
+++ b/debian/patches/0001-Use-php_format_date-instead-of-php_std_date.patch
@@ -0,0 +1,63 @@
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 4 Jul 2025 12:13:08 +0200
+Subject: Use php_format_date instead of php_std_date
+
+- php_format_date exists in 7.4+
+- php_std_date removed in 8.5
+
+x
+---
+ amqp-2.1.2/amqp_connection_resource.c | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/amqp-2.1.2/amqp_connection_resource.c b/amqp-2.1.2/amqp_connection_resource.c
+index 56194da..0fee488 100644
+--- a/amqp-2.1.2/amqp_connection_resource.c
++++ b/amqp-2.1.2/amqp_connection_resource.c
+@@ -26,7 +26,7 @@
+ #endif
+
+ #include "php.h"
+-#include "ext/standard/datetime.h"
++#include "ext/date/php_date.h"
+ #include "zend_exceptions.h"
+
+ #ifdef PHP_WIN32
+@@ -469,8 +469,8 @@ amqp_connection_resource *connection_resource_constructor(amqp_connection_params
+ {
+ struct timeval tv = {0};
+ struct timeval *tv_ptr = &tv;
++ zend_string *std_datetime;
+
+- char *std_datetime;
+ amqp_table_entry_t client_properties_entries[4];
+ amqp_table_t client_properties_table;
+
+@@ -580,8 +580,6 @@ amqp_connection_resource *connection_resource_constructor(amqp_connection_params
+ return NULL;
+ }
+
+- std_datetime = php_std_date(time(NULL));
+-
+ client_properties_entries[0].key = amqp_cstring_bytes("type");
+ client_properties_entries[0].value.kind = AMQP_FIELD_KIND_UTF8;
+ client_properties_entries[0].value.value.bytes = amqp_cstring_bytes("php-amqp extension");
+@@ -596,7 +594,8 @@ amqp_connection_resource *connection_resource_constructor(amqp_connection_params
+
+ client_properties_entries[3].key = amqp_cstring_bytes("connection started");
+ client_properties_entries[3].value.kind = AMQP_FIELD_KIND_UTF8;
+- client_properties_entries[3].value.value.bytes = amqp_cstring_bytes(std_datetime);
++ std_datetime = php_format_date("D, d M Y H:i:s \\G\\M\\T", sizeof("D, d M Y H:i:s \\G\\M\\T")-1, time(NULL), 0);
++ client_properties_entries[3].value.value.bytes = amqp_cstring_bytes(ZSTR_VAL(std_datetime));
+
+ client_properties_table.entries = client_properties_entries;
+ client_properties_table.num_entries = sizeof(client_properties_entries) / sizeof(amqp_table_entry_t);
+@@ -631,7 +630,7 @@ amqp_connection_resource *connection_resource_constructor(amqp_connection_params
+ params->password
+ );
+
+- efree(std_datetime);
++ zend_string_release(std_datetime);
+
+ if (AMQP_RESPONSE_NORMAL != res.reply_type) {
+ char *message = NULL, *long_message = NULL;
diff --git a/debian/patches/0002-use-zend_ce_exception.patch b/debian/patches/0002-use-zend_ce_exception.patch
new file mode 100644
index 0000000..f2a55d5
--- /dev/null
+++ b/debian/patches/0002-use-zend_ce_exception.patch
@@ -0,0 +1,35 @@
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 15 Jul 2025 14:50:40 +0200
+Subject: use zend_ce_exception
+
+---
+ amqp-2.1.2/amqp.c | 2 +-
+ amqp-2.1.2/amqp_queue.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/amqp-2.1.2/amqp.c b/amqp-2.1.2/amqp.c
+index ef04488..84a87b7 100644
+--- a/amqp-2.1.2/amqp.c
++++ b/amqp-2.1.2/amqp.c
+@@ -276,7 +276,7 @@ static PHP_MINIT_FUNCTION(amqp) /* {{{ */
+
+ /* Exceptions */
+ INIT_CLASS_ENTRY(ce, "AMQPException", NULL);
+- amqp_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default());
++ amqp_exception_class_entry = zend_register_internal_class_ex(&ce, zend_ce_exception);
+
+ INIT_CLASS_ENTRY(ce, "AMQPConnectionException", NULL);
+ amqp_connection_exception_class_entry = zend_register_internal_class_ex(&ce, amqp_exception_class_entry);
+diff --git a/amqp-2.1.2/amqp_queue.c b/amqp-2.1.2/amqp_queue.c
+index 67229a0..db9cafc 100644
+--- a/amqp-2.1.2/amqp_queue.c
++++ b/amqp-2.1.2/amqp_queue.c
+@@ -754,7 +754,7 @@ static PHP_METHOD(amqp_queue_class, consume)
+ ZVAL_UNDEF(&exception);
+ object_init_ex(&exception, amqp_envelope_exception_class_entry);
+ zend_update_property_string(
+- zend_exception_get_default(),
++ zend_ce_exception,
+ PHP_AMQP_COMPAT_OBJ_P(&exception),
+ ZEND_STRL("message"),
+ "Orphaned envelope"
diff --git a/debian/patches/0003-Silent-the-not-representable-as-an-int-warning.patch b/debian/patches/0003-Silent-the-not-representable-as-an-int-warning.patch
new file mode 100644
index 0000000..6389c78
--- /dev/null
+++ b/debian/patches/0003-Silent-the-not-representable-as-an-int-warning.patch
@@ -0,0 +1,33 @@
+From: Remi Collet <remi@remirepo.net>
+Date: Mon, 29 Sep 2025 07:49:28 +0200
+Subject: Silent the "not representable as an int" warning
+
+---
+ amqp-2.1.2/tests/amqpconnection_validation.phpt | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/amqp-2.1.2/tests/amqpconnection_validation.phpt b/amqp-2.1.2/tests/amqpconnection_validation.phpt
+index 9f67cf6..bb1790c 100644
+--- a/amqp-2.1.2/tests/amqpconnection_validation.phpt
++++ b/amqp-2.1.2/tests/amqpconnection_validation.phpt
+@@ -26,7 +26,12 @@ foreach ($parameters as $args) {
+ list($prop, $setter, $getter, $values) = $args;
+ foreach ($values as $value) {
+ try {
+- $con1 = new AMQPConnection([$prop => $value]);
++ if (in_array($prop, ['frame_max', 'heartbeat'])) {
++ // Silent the "not representable as an int" warning
++ $con1 = @new AMQPConnection([$prop => $value]);
++ } else {
++ $con1 = new AMQPConnection([$prop => $value]);
++ }
+ echo $getter . " after constructor: ";
+ echo $con1->{$getter}();
+ echo PHP_EOL;
+@@ -109,4 +114,4 @@ AMQPConnectionException: Parameter 'heartbeat' is out of range.
+ AMQPConnectionException: Parameter 'heartbeat' is out of range.
+ getHeartbeatInterval after constructor: 250
+ getHeartbeatInterval after constructor: 0
+-==DONE==
+\ No newline at end of file
++==DONE==
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..651c471
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,3 @@
+0001-Use-php_format_date-instead-of-php_std_date.patch
+0002-use-zend_ce_exception.patch
+0003-Silent-the-not-representable-as-an-int-warning.patch

File Metadata

Mime Type
text/x-diff
Expires
Fri, Feb 6, 5:49 PM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
55671
Default Alt Text
(6 KB)

Event Timeline