diff options
| author | Remi Collet <remi@remirepo.net> | 2025-07-04 12:41:00 +0200 | 
|---|---|---|
| committer | Remi Collet <remi@php.net> | 2025-07-04 12:41:00 +0200 | 
| commit | dca4926a7704c0a1a391380e67cc21141f151c3e (patch) | |
| tree | 00767d2c21446a3a4ceda05a373275d966e54350 | |
| parent | 9733fc579795887a466ef1b4d7d289fdcede21ce (diff) | |
add patch for PHP 8.5 from
  https://github.com/php-amqp/php-amqp/pull/595
| -rw-r--r-- | 595.patch | 64 | ||||
| -rw-r--r-- | php-pecl-amqp.spec | 27 | 
2 files changed, 83 insertions, 8 deletions
diff --git a/595.patch b/595.patch new file mode 100644 index 0000000..707c995 --- /dev/null +++ b/595.patch @@ -0,0 +1,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; diff --git a/php-pecl-amqp.spec b/php-pecl-amqp.spec index d55a402..72607c7 100644 --- a/php-pecl-amqp.spec +++ b/php-pecl-amqp.spec @@ -3,9 +3,9 @@  #  # Fedora spec file for php-pecl-amqp  # -# Copyright (c) 2012-2024 Remi Collet -# License: CC-BY-SA-4.0 -# http://creativecommons.org/licenses/by-sa/4.0/ +# SPDX-FileCopyrightText:  Copyright 2012-2025 Remi Collet +# SPDX-License-Identifier: CECILL-2.1 +# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt  #  # Please, preserve the changelog entries  # @@ -16,6 +16,8 @@  %bcond_with              server  %global with_zts         0%{!?_without_zts:%{?__ztsphp:1}} +%global pie_vend         php-amqp +%global pie_proj         php-amqp  %global pecl_name        amqp  %global ini_name         40-%{pecl_name}.ini  %global upstream_version 2.1.2 @@ -29,11 +31,13 @@  Summary:       Communicate with any AMQP compliant server  Name:          %{?scl_prefix}php-pecl-amqp  Version:       %{upstream_version}%{?upstream_prever:~%{upstream_lower}} -Release:       1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release:       2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}  License:       PHP-3.01  URL:           https://pecl.php.net/package/amqp  Source0:       https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz +Patch0:        595.patch +  BuildRequires: make  BuildRequires: %{?dtsprefix}gcc  BuildRequires: %{?scl_prefix}php-devel >= 7.4 @@ -48,10 +52,11 @@ BuildRequires: hostname  Requires:         %{?scl_prefix}php(zend-abi) = %{php_zend_api}  Requires:         %{?scl_prefix}php(api) = %{php_core_api} -Provides:         %{?scl_prefix}php-%{pecl_name}               = %{version} -Provides:         %{?scl_prefix}php-%{pecl_name}%{?_isa}       = %{version} -Provides:         %{?scl_prefix}php-pecl(%{pecl_name})         = %{version} -Provides:         %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} +Provides:         %{?scl_prefix}php-%{pecl_name}                 = %{version} +Provides:         %{?scl_prefix}php-%{pecl_name}%{?_isa}         = %{version} +Provides:         %{?scl_prefix}php-pecl(%{pecl_name})           = %{version} +Provides:         %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa}   = %{version} +Provides:         %{?scl_prefix}php-pie(%{pie_vend}/%{pie_proj}) = %{version}  %description @@ -72,6 +77,8 @@ sed -e 's/role="test"/role="src"/' \      -i package.xml  cd %{sources} +%patch -P0 -p1 -b .pr595 +  # Upstream often forget to change this  extver=$(sed -n '/#define PHP_AMQP_VERSION /{s/.* "//;s/".*$//;p}' php_amqp_version.h)  if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then @@ -246,6 +253,10 @@ exit $ret  %changelog +* Fri Jul  4 2025 Remi Collet <remi@remirepo.net> - 2.1.2-2 +- add patch for PHP 8.5 from +  https://github.com/php-amqp/php-amqp/pull/595 +  * Mon Jan 22 2024 Remi Collet <remi@remirepo.net> - 2.1.2-1  - update to 2.1.2  | 
