1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
From 789de276603ca54cf85c958bf996c4faedf73223 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 4 Jul 2025 12:13:08 +0200
Subject: [PATCH] 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_connection_resource.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/amqp_connection_resource.c b/amqp_connection_resource.c
index 8809a20b..eaf857e7 100644
--- a/amqp_connection_resource.c
+++ b/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
@@ -470,8 +470,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;
@@ -581,8 +581,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");
@@ -597,7 +595,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);
@@ -632,7 +631,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;
|