[packages/php-pecl-imap] New, version 1.0.3
arekm
arekm at pld-linux.org
Thu Nov 5 12:34:49 CET 2026
commit d54bffb53e24decf9f6d73689db130448f4f7176
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Nov 5 12:12:42 2026 +0100
New, version 1.0.3
PECL imap extension; PHP 8.4 dropped ext/imap from core. Builds with
PHP 8.4-8.6.
php-pecl-imap.spec | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++
php86-ini_str.patch | 16 ++++++++
php86-offsetof.patch | 63 +++++++++++++++++++++++++++++++
3 files changed, 183 insertions(+)
---
diff --git a/php-pecl-imap.spec b/php-pecl-imap.spec
new file mode 100644
index 0000000..d275130
--- /dev/null
+++ b/php-pecl-imap.spec
@@ -0,0 +1,104 @@
+#
+# Conditional build:
+%bcond_without tests # build without tests
+
+%define php_name php%{?php_suffix}
+%define modname imap
+Summary: IMAP extension module for PHP
+Summary(pl.UTF-8): Moduł IMAP dla PHP
+Name: %{php_name}-pecl-%{modname}
+Version: 1.0.3
+Release: 1
+License: PHP 3.01
+Group: Development/Languages/PHP
+Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz
+# Source0-md5: bc940661e16af74e592de618060a1be6
+Patch0: php86-offsetof.patch
+Patch1: php86-ini_str.patch
+URL: https://pecl.php.net/package/imap
+BuildRequires: %{php_name}-cli
+# PHP < 8.4 ships imap.so in its own phpXY-imap package
+BuildRequires: %{php_name}-devel >= 4:8.4.0
+%{?with_tests:BuildRequires: %{php_name}-pcre}
+BuildRequires: imap-devel
+BuildRequires: openssl-devel
+BuildRequires: rpmbuild(macros) >= 1.666
+%{?requires_php_extension}
+Provides: php(imap) = %{version}
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+This is a dynamic shared object (DSO) for PHP that will add support
+for the IMAP protocol, as well as the NNTP, POP3, and local mailbox
+access methods.
+
+%description -l pl.UTF-8
+Moduł PHP dodający obsługę protokołu IMAP, a także NNTP, POP3 oraz
+lokalnych skrzynek pocztowych.
+
+%prep
+%setup -qc
+mv %{modname}-%{version}/* .
+%patch -P0 -p1
+%patch -P1 -p1
+
+cat <<'EOF' > run-tests.sh
+#!/bin/sh
+export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
+exec %{__make} test \
+ PHP_EXECUTABLE=%{__php} \
+ PHP_TEST_SHARED_SYSTEM_EXTENSIONS="" \
+ RUN_TESTS_SETTINGS="-q $*"
+EOF
+chmod +x run-tests.sh
+
+%build
+phpize
+# PLD c-client is built without GSSAPI, so --with-kerberos would add nothing
+%configure \
+ --with-libdir=%{_lib} \
+ --with-imap=shared,/usr \
+ --with-imap-ssl \
+ --without-kerberos
+
+%{__make}
+
+# simple module load test
+%{__php} -n -q \
+ -d extension_dir=modules \
+ -d extension=%{modname}.so \
+ -m > modules.log
+grep "^%{modname}$" modules.log
+
+%if %{with tests}
+./run-tests.sh --show-diff
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__make} install \
+ EXTENSION_DIR=%{php_extensiondir} \
+ INSTALL_ROOT=$RPM_BUILD_ROOT
+
+install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
+cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
+; Enable %{modname} extension module
+extension=%{modname}.so
+EOF
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+%php_webserver_restart
+
+%postun
+if [ "$1" = 0 ]; then
+ %php_webserver_restart
+fi
+
+%files
+%defattr(644,root,root,755)
+%doc CREDITS LICENSE
+%config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
+%attr(755,root,root) %{php_extensiondir}/%{modname}.so
diff --git a/php86-ini_str.patch b/php86-ini_str.patch
new file mode 100644
index 0000000..afa7092
--- /dev/null
+++ b/php86-ini_str.patch
@@ -0,0 +1,16 @@
+PHP 8.6 removed INI_STR(); imap_mail() then fails to build.
+
+--- a/php_imap.c 2024-10-15 12:02:11.000000000 +0200
++++ b/php_imap.c 2026-11-05 12:11:44.842844850 +0100
+@@ -47,6 +47,11 @@
+ #endif
+ #include "php_imap.h"
+
++/* PHP 8.6 removed INI_STR() */
++#ifndef INI_STR
++# define INI_STR(name) zend_ini_string_literal(name)
++#endif
++
+ #include <time.h>
+ #include <stdio.h>
+ #include <ctype.h>
diff --git a/php86-offsetof.patch b/php86-offsetof.patch
new file mode 100644
index 0000000..418fcb8
--- /dev/null
+++ b/php86-offsetof.patch
@@ -0,0 +1,63 @@
+https://github.com/php/pecl-mail-imap/pull/22
+
+From 13d0e22571ce5805d30de1cfb12cdedbf58766e9 Mon Sep 17 00:00:00 2001
+From: SirLouen <sir.louen at gmail.com>
+Date: Fri, 9 Oct 2026 11:44:38 +0200
+Subject: [PATCH] fix(connection): use offsetof() instead of XtOffsetOf()
+
+---
+ php_imap.c | 2 +-
+ tests/imap_connection_free.phpt | 31 +++++++++++++++++++++++++++++++
+ 2 files changed, 32 insertions(+), 1 deletion(-)
+ create mode 100644 tests/imap_connection_free.phpt
+
+diff --git a/php_imap.c b/php_imap.c
+index df2f8dd..94dd3d5 100644
+--- a/php_imap.c
++++ b/php_imap.c
+@@ -460,7 +460,7 @@ PHP_MINIT_FUNCTION(imap)
+ php_imap_ce->create_object = imap_object_create;
+
+ memcpy(&imap_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
+- imap_object_handlers.offset = XtOffsetOf(php_imap_object, std);
++ imap_object_handlers.offset = offsetof(php_imap_object, std);
+ imap_object_handlers.get_constructor = imap_object_get_constructor;
+ imap_object_handlers.free_obj = imap_object_destroy;
+ imap_object_handlers.clone_obj = NULL;
+diff --git a/tests/imap_connection_free.phpt b/tests/imap_connection_free.phpt
+new file mode 100644
+index 0000000..7766780
+--- /dev/null
++++ b/tests/imap_connection_free.phpt
+@@ -0,0 +1,31 @@
++--TEST--
++IMAP\Connection objects are created and freed correctly
++--EXTENSIONS--
++imap
++--ENV--
++USE_ZEND_ALLOC=0
++--FILE--
++<?php
++// OP_PROTOTYPE returns the driver's prototype stream without connecting
++$connections = [];
++for ($i = 0; $i < 100; $i++) {
++ foreach (['{localhost/imap}', '{localhost/pop3}', '{localhost/nntp}'] as $mailbox) {
++ $connections[] = imap_open($mailbox, '', '', OP_PROTOTYPE);
++ }
++}
++var_dump(count($connections), $connections[0] instanceof IMAP\Connection);
++$connections = null;
++gc_collect_cycles();
++
++try {
++ new IMAP\Connection();
++} catch (Error $e) {
++ echo $e->getMessage(), "\n";
++}
++echo "Done\n";
++?>
++--EXPECT--
++int(300)
++bool(true)
++Cannot directly construct IMAP\Connection, use imap_open() instead
++Done
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/php-pecl-imap.git/commitdiff/d54bffb53e24decf9f6d73689db130448f4f7176
More information about the pld-cvs-commit
mailing list