summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-ast.spec22
-rw-r--r--php85.patch50
2 files changed, 67 insertions, 5 deletions
diff --git a/php-ast.spec b/php-ast.spec
index 2a8d7d6..21226a7 100644
--- a/php-ast.spec
+++ b/php-ast.spec
@@ -1,14 +1,16 @@
# remirepo spec file for php-ast
#
-# Copyright (c) 2015-2024 Remi Collet
-# License: CC-BY-SA-4.0
-# http://creativecommons.org/licenses/by-sa/4.0/
+# SPDX-FileCopyrightText: Copyright 2015-2025 Remi Collet
+# SPDX-License-Identifier: CECILL-2.1
+# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
#
# Please, preserve the changelog entries
#
%{?scl:%scl_package php-ast}
%global pecl_name ast
+%global pie_vend nikic
+%global pie_proj php-ast
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
# After 20-tokenizer.ini
%global ini_name 40-%{pecl_name}.ini
@@ -18,11 +20,13 @@
Summary: Abstract Syntax Tree
Name: %{?scl_prefix}php-ast
Version: 1.1.2
-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: BSD-3-Clause
URL: https://pecl.php.net/package/ast
Source0: http://pecl.php.net/get/%{sources}.tgz
+Patch0: php85.patch
+
BuildRequires: make
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 7.2
@@ -33,11 +37,13 @@ Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}php(api) = %{php_core_api}
Requires: %{?scl_prefix}php-tokenizer%{?_isa}
-# PECL
+# PECL/PIE
Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release}
Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release}
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}
+Provides: %{?scl_prefix}php-%{pie_vend}-%{pie_proj} = %{version}
%description
@@ -55,6 +61,8 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd %{sources}
+%patch -P0 -p1
+
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_AST_VERSION/{s/.* "//;s/".*$//;p}' php_ast.h)
if test "x${extver}" != "x%{version}"; then
@@ -165,6 +173,10 @@ TEST_PHP_ARGS="-n -d extension=tokenizer.so -d extension=%{buildroot}%{php_ztsex
%changelog
+* Fri Jul 4 2025 Remi Collet <remi@remirepo.net> - 1.1.2-2
+- fix for PHP 8.5 using patch from upstream and from
+ https://github.com/nikic/php-ast/pull/253
+
* Mon Aug 12 2024 Remi Collet <remi@remirepo.net> - 1.1.2-1
- update to 1.1.2
diff --git a/php85.patch b/php85.patch
new file mode 100644
index 0000000..ba00564
--- /dev/null
+++ b/php85.patch
@@ -0,0 +1,50 @@
+From d546378de770fbe5d40a7bf181d2b77ea408f59f Mon Sep 17 00:00:00 2001
+From: Nikita Popov <github@npopov.com>
+Date: Sun, 1 Jun 2025 17:33:35 +0200
+Subject: [PATCH] Add compatibility define for ZEND_AST_EXIT
+
+---
+ php_ast.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/php_ast.h b/php_ast.h
+index 29e4450..4ba3bbc 100644
+--- a/php_ast.h
++++ b/php_ast.h
+@@ -93,6 +93,11 @@ extern ast_str_globals str_globals;
+ # define ZEND_AST_PARENT_PROPERTY_HOOK_CALL 0x2f8
+ #endif
+
++/* ZEND_AST_EXIT has been replaced with plain function call. */
++#if PHP_VERSION_ID >= 80500
++# define ZEND_AST_EXIT 0x1fd
++#endif
++
+ /* Pretend it still exists */
+ # define ZEND_AST_LIST ((1 << (ZEND_AST_IS_LIST_SHIFT + 1)) - 1)
+
+From 69c9ca89d4db6c5aabbeaaf7f22dfe979907d60a Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 9 Jul 2025 12:38:30 +0200
+Subject: [PATCH] Add compatibility define for ZEND_AST_CLONE
+
+---
+ php_ast.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/php_ast.h b/php_ast.h
+index 4ba3bbc..0eeb28c 100644
+--- a/php_ast.h
++++ b/php_ast.h
+@@ -93,9 +93,10 @@ extern ast_str_globals str_globals;
+ # define ZEND_AST_PARENT_PROPERTY_HOOK_CALL 0x2f8
+ #endif
+
+-/* ZEND_AST_EXIT has been replaced with plain function call. */
++/* ZEND_AST_EXIT and ZEND_AST_CLONE have been replaced with plain function call. */
+ #if PHP_VERSION_ID >= 80500
+ # define ZEND_AST_EXIT 0x1fd
++# define ZEND_AST_CLONE 0x1fc
+ #endif
+
+ /* Pretend it still exists */