!189 [sync] PR-181: Fix GH-14480 Method visibility issue introduced in version 8.3.8

From: @openeuler-sync-bot 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
This commit is contained in:
openeuler-ci-bot 2024-06-17 11:23:59 +00:00 committed by Gitee
commit 6e7171b301
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 134 additions and 28 deletions

101
php-gh14480.patch Normal file
View File

@ -0,0 +1,101 @@
From 86b93bc479477e6c0de6207bfe59c1e276dfdafb Mon Sep 17 00:00:00 2001
From: Dmitry Stogov <dmitry@zend.com>
Date: Wed, 5 Jun 2024 23:53:31 +0300
Subject: [PATCH] Fix GH-14480: Method visibility issue introduced in version
8.3.8 (#14484)
---
Zend/tests/gh14480.phpt | 60 +++++++++++++++++++++++++++++++++++++++++
Zend/zend_inheritance.c | 8 +++---
2 files changed, 65 insertions(+), 3 deletions(-)
create mode 100644 Zend/tests/gh14480.phpt
diff --git a/Zend/tests/gh14480.phpt b/Zend/tests/gh14480.phpt
new file mode 100644
index 0000000000000..bab74785b6b23
--- /dev/null
+++ b/Zend/tests/gh14480.phpt
@@ -0,0 +1,60 @@
+--TEST--
+GH-14480: Method visibility issue
+--FILE--
+<?php
+trait PropertyHelperTrait
+{
+ protected function splitPropertyParts(): void
+ {
+ echo "OK\n";
+ }
+}
+
+trait OrmPropertyHelperTrait
+{
+ abstract protected function splitPropertyParts(): void;
+
+ protected function addJoinsForNestedProperty(): void
+ {
+ $this->splitPropertyParts();
+ }
+}
+
+trait SearchFilterTrait
+{
+ use PropertyHelperTrait;
+}
+
+abstract class AbstractFilter
+{
+ use OrmPropertyHelperTrait, PropertyHelperTrait;
+
+ public function apply(): void
+ {
+ $this->filterProperty();
+ }
+
+ abstract protected function filterProperty(): void;
+}
+
+class SearchFilter extends AbstractFilter
+{
+ use SearchFilterTrait;
+ protected function filterProperty(): void
+ {
+ $this->addJoinsForNestedProperty();
+ }
+}
+
+class FilterExtension
+{
+ public function applyToCollection(): void
+ {
+ (new SearchFilter())->apply();
+ }
+}
+
+(new FilterExtension)->applyToCollection();
+?>
+--EXPECT--
+OK
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 402354baa8..228c5b6e54 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -2018,12 +2018,14 @@ static void zend_add_trait_method(zend_class_entry *ce, zend_string *name, zend_
if (check_inheritance) {
/* Inherited members are overridden by members inserted by traits.
* Check whether the trait method fulfills the inheritance requirements. */
+ uint32_t flags = ZEND_INHERITANCE_CHECK_PROTO | ZEND_INHERITANCE_CHECK_VISIBILITY;
+ if (!(existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT)) {
+ flags |= ZEND_INHERITANCE_SET_CHILD_CHANGED |ZEND_INHERITANCE_SET_CHILD_PROTO |
+ ZEND_INHERITANCE_RESET_CHILD_OVERRIDE;
+ }
do_inheritance_check_on_method(
fn, fixup_trait_scope(fn, ce), existing_fn, fixup_trait_scope(existing_fn, ce),
- ce, NULL,
- ZEND_INHERITANCE_CHECK_PROTO | ZEND_INHERITANCE_CHECK_VISIBILITY |
- ZEND_INHERITANCE_SET_CHILD_CHANGED| ZEND_INHERITANCE_SET_CHILD_PROTO |
- ZEND_INHERITANCE_RESET_CHILD_OVERRIDE);
+ ce, NULL, flags);
}
}
/* }}} */

View File

@ -28,7 +28,7 @@
Name: php Name: php
Version: %{upver} Version: %{upver}
Release: 1 Release: 2
Summary: PHP scripting language for creating dynamic web sites Summary: PHP scripting language for creating dynamic web sites
License: PHP-3.01 AND Zend-2.0 AND BSD-2-Clause AND MIT AND Apache-1.0 AND NCSA AND BSL-1.0 License: PHP-3.01 AND Zend-2.0 AND BSD-2-Clause AND MIT AND Apache-1.0 AND NCSA AND BSL-1.0
URL: http://www.php.net/ URL: http://www.php.net/
@ -62,6 +62,7 @@ Patch6: php-7.4.0-phpize.patch
Patch7: php-7.4.0-ldap_r.patch Patch7: php-7.4.0-ldap_r.patch
Patch8: php-8.1.0-phpinfo.patch Patch8: php-8.1.0-phpinfo.patch
Patch9: php-8.3.0-openssl-ec-param.patch Patch9: php-8.3.0-openssl-ec-param.patch
Patch10: php-gh14480.patch
BuildRequires: gnupg2 BuildRequires: gnupg2
@ -133,7 +134,7 @@ running in prefork mode. This module is deprecated.
%package cli %package cli
Summary: Command-line interface for PHP Summary: Command-line interface for PHP
License: PHP and Zend and BSD and MIT and ASL 1.0 and NCSA and PostgreSQL License: PHP-3.01 AND Zend-2.0 AND BSD-2-Clause AND MIT AND Apache-1.0 AND NCSA AND PostgreSQL
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
Provides: php-cgi = %{version}-%{release}, php-cgi%{?_isa} = %{version}-%{release} Provides: php-cgi = %{version}-%{release}, php-cgi%{?_isa} = %{version}-%{release}
Provides: php-pcntl, php-pcntl%{?_isa} Provides: php-pcntl, php-pcntl%{?_isa}
@ -171,7 +172,7 @@ any size, especially busier sites.
%package common %package common
Summary: Common files for PHP Summary: Common files for PHP
License: PHP and BSD License: PHP-3.01 AND BSD-2-Clause
Provides: php(api) = %{apiver}-%{__isa_bits} Provides: php(api) = %{apiver}-%{__isa_bits}
Provides: php(zend-abi) = %{zendver}-%{__isa_bits} Provides: php(zend-abi) = %{zendver}-%{__isa_bits}
Provides: php(language) = %{version}, php(language)%{?_isa} = %{version} Provides: php(language) = %{version}, php(language)%{?_isa} = %{version}
@ -238,7 +239,7 @@ need to install this package.
%package opcache %package opcache
Summary: The Zend OPcache Summary: The Zend OPcache
License: PHP License: PHP-3.01
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
Provides: php-pecl-zendopcache = %{version} Provides: php-pecl-zendopcache = %{version}
Provides: php-pecl-zendopcache%{?_isa} = %{version} Provides: php-pecl-zendopcache%{?_isa} = %{version}
@ -255,7 +256,7 @@ bytecode optimization patterns that make code execution faster.
%if %{with_imap} %if %{with_imap}
%package imap %package imap
Summary: A module for PHP applications that use IMAP Summary: A module for PHP applications that use IMAP
License: PHP License: PHP-3.01
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
BuildRequires: pkgconfig(krb5) BuildRequires: pkgconfig(krb5)
BuildRequires: pkgconfig(krb5-gssapi) BuildRequires: pkgconfig(krb5-gssapi)
@ -270,7 +271,7 @@ messages on mail servers. PHP is an HTML-embedded scripting language.
%package ldap %package ldap
Summary: A module for PHP applications that use LDAP Summary: A module for PHP applications that use LDAP
License: PHP License: PHP-3.01
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
BuildRequires: pkgconfig(libsasl2) BuildRequires: pkgconfig(libsasl2)
BuildRequires: openldap-devel BuildRequires: openldap-devel
@ -284,7 +285,7 @@ language.
%package pdo %package pdo
Summary: A database access abstraction module for PHP applications Summary: A database access abstraction module for PHP applications
License: PHP License: PHP-3.01
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
Provides: php-pdo-abi = %{pdover}-%{__isa_bits} Provides: php-pdo-abi = %{pdover}-%{__isa_bits}
Provides: php(pdo-abi) = %{pdover}-%{__isa_bits} Provides: php(pdo-abi) = %{pdover}-%{__isa_bits}
@ -299,7 +300,7 @@ databases.
%package mysqlnd %package mysqlnd
Summary: A module for PHP applications that use MySQL databases Summary: A module for PHP applications that use MySQL databases
License: PHP License: PHP-3.01
Requires: php-pdo%{?_isa} = %{version}-%{release} Requires: php-pdo%{?_isa} = %{version}-%{release}
Provides: php_database Provides: php_database
Provides: php-mysqli = %{version}-%{release} Provides: php-mysqli = %{version}-%{release}
@ -317,7 +318,7 @@ This package use the MySQL Native Driver
%package pgsql %package pgsql
Summary: A PostgreSQL database module for PHP Summary: A PostgreSQL database module for PHP
License: PHP License: PHP-3.01
Requires: php-pdo%{?_isa} = %{version}-%{release} Requires: php-pdo%{?_isa} = %{version}-%{release}
Provides: php_database Provides: php_database
Provides: php-pdo_pgsql, php-pdo_pgsql%{?_isa} Provides: php-pdo_pgsql, php-pdo_pgsql%{?_isa}
@ -335,7 +336,7 @@ php package.
%package process %package process
Summary: Modules for PHP script using system process interfaces Summary: Modules for PHP script using system process interfaces
License: PHP License: PHP-3.01
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
Provides: php-posix, php-posix%{?_isa} Provides: php-posix, php-posix%{?_isa}
Provides: php-shmop, php-shmop%{?_isa} Provides: php-shmop, php-shmop%{?_isa}
@ -350,7 +351,7 @@ communication.
%package odbc %package odbc
Summary: A module for PHP applications that use ODBC databases Summary: A module for PHP applications that use ODBC databases
License: PHP License: PHP-3.01
Requires: php-pdo%{?_isa} = %{version}-%{release} Requires: php-pdo%{?_isa} = %{version}-%{release}
Provides: php_database Provides: php_database
Provides: php-pdo_odbc, php-pdo_odbc%{?_isa} Provides: php-pdo_odbc, php-pdo_odbc%{?_isa}
@ -367,7 +368,7 @@ package.
%package soap %package soap
Summary: A module for PHP applications that use the SOAP protocol Summary: A module for PHP applications that use the SOAP protocol
License: PHP License: PHP-3.01
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(libxml-2.0)
@ -378,7 +379,7 @@ support to PHP for using the SOAP web services protocol.
%if %{with_firebird} %if %{with_firebird}
%package pdo-firebird %package pdo-firebird
Summary: PDO driver for Interbase/Firebird databases Summary: PDO driver for Interbase/Firebird databases
License: PHP License: PHP-3.01
BuildRequires: firebird-devel BuildRequires: firebird-devel
Requires: php-pdo%{?_isa} = %{version}-%{release} Requires: php-pdo%{?_isa} = %{version}-%{release}
Provides: php_database Provides: php_database
@ -391,7 +392,7 @@ Interbase/Firebird databases.
%package snmp %package snmp
Summary: A module for PHP applications that query SNMP-managed devices Summary: A module for PHP applications that query SNMP-managed devices
License: PHP License: PHP-3.01
Requires: php-common%{?_isa} = %{version}-%{release}, net-snmp Requires: php-common%{?_isa} = %{version}-%{release}, net-snmp
BuildRequires: net-snmp-devel BuildRequires: net-snmp-devel
@ -403,7 +404,7 @@ will need to install this package and the php package.
%package xml %package xml
Summary: A module for PHP applications which use XML Summary: A module for PHP applications which use XML
License: PHP License: PHP-3.01
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
Provides: php-dom, php-dom%{?_isa} Provides: php-dom, php-dom%{?_isa}
Provides: php-domxml, php-domxml%{?_isa} Provides: php-domxml, php-domxml%{?_isa}
@ -422,7 +423,7 @@ and performing XSL transformations on XML documents.
%package mbstring %package mbstring
Summary: A module for PHP applications which need multi-byte string handling Summary: A module for PHP applications which need multi-byte string handling
License: PHP and LGPLv2 and OpenLDAP License: PHP-3.01 AND LGPL-2.1-only AND OLDAP-2.8
BuildRequires: pkgconfig(oniguruma) >= 6.8 BuildRequires: pkgconfig(oniguruma) >= 6.8
Provides: bundled(libmbfl) = 1.3.2 Provides: bundled(libmbfl) = 1.3.2
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
@ -433,7 +434,7 @@ support for multi-byte string handling to PHP.
%package gd %package gd
Summary: A module for PHP applications for using the gd graphics library Summary: A module for PHP applications for using the gd graphics library
License: PHP License: PHP-3.01
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
BuildRequires: pkgconfig(gdlib) >= 2.1.1 BuildRequires: pkgconfig(gdlib) >= 2.1.1
@ -443,7 +444,7 @@ support for using the gd graphics library to PHP.
%package bcmath %package bcmath
Summary: A module for PHP applications for using the bcmath library Summary: A module for PHP applications for using the bcmath library
License: PHP and LGPLv2+ License: PHP-3.01 AND LGPL-2.1-or-later
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
%description bcmath %description bcmath
@ -452,7 +453,7 @@ support for using the bcmath library to PHP.
%package gmp %package gmp
Summary: A module for PHP applications for using the GNU MP library Summary: A module for PHP applications for using the GNU MP library
License: PHP License: PHP-3.01
BuildRequires: gmp-devel BuildRequires: gmp-devel
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
@ -462,7 +463,7 @@ using the GNU MP library.
%package dba %package dba
Summary: A database abstraction layer module for PHP applications Summary: A database abstraction layer module for PHP applications
License: PHP License: PHP-3.01
%if %{with_db4} %if %{with_db4}
BuildRequires: libdb-devel BuildRequires: libdb-devel
%endif %endif
@ -482,7 +483,7 @@ support for using the DBA database abstraction layer to PHP.
%if %{with_tidy} %if %{with_tidy}
%package tidy %package tidy
Summary: Standard PHP module provides tidy library support Summary: Standard PHP module provides tidy library support
License: PHP License: PHP-3.01
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
BuildRequires: libtidy-devel BuildRequires: libtidy-devel
@ -494,7 +495,7 @@ support for using the tidy library to PHP.
%if %{with_freetds} %if %{with_freetds}
%package pdo-dblib %package pdo-dblib
Summary: PDO driver for Microsoft SQL Server and Sybase databases Summary: PDO driver for Microsoft SQL Server and Sybase databases
License: PHP License: PHP-3.01
Requires: php-pdo%{?_isa} = %{version}-%{release} Requires: php-pdo%{?_isa} = %{version}-%{release}
BuildRequires: freetds-devel BuildRequires: freetds-devel
Provides: php-pdo_dblib, php-pdo_dblib%{?_isa} Provides: php-pdo_dblib, php-pdo_dblib%{?_isa}
@ -518,7 +519,7 @@ into applications to provide PHP scripting language support.
%if %{with_pspell} %if %{with_pspell}
%package pspell %package pspell
Summary: A module for PHP applications for using pspell interfaces Summary: A module for PHP applications for using pspell interfaces
License: PHP License: PHP-3.01
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
BuildRequires: aspell-devel >= 0.50.0 BuildRequires: aspell-devel >= 0.50.0
@ -529,7 +530,7 @@ support for using the pspell library to PHP.
%package intl %package intl
Summary: Internationalization extension for PHP applications Summary: Internationalization extension for PHP applications
License: PHP License: PHP-3.01
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
BuildRequires: pkgconfig(icu-i18n) >= 50.1 BuildRequires: pkgconfig(icu-i18n) >= 50.1
BuildRequires: pkgconfig(icu-io) >= 50.1 BuildRequires: pkgconfig(icu-io) >= 50.1
@ -541,7 +542,7 @@ support for using the ICU library to PHP.
%package enchant %package enchant
Summary: Enchant spelling extension for PHP applications Summary: Enchant spelling extension for PHP applications
License: PHP License: PHP-3.01
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
BuildRequires: pkgconfig(enchant-2) BuildRequires: pkgconfig(enchant-2)
@ -552,7 +553,7 @@ support for using the enchant library to PHP.
%if %{with_sodium} %if %{with_sodium}
%package sodium %package sodium
Summary: Wrapper for the Sodium cryptographic library Summary: Wrapper for the Sodium cryptographic library
License: PHP License: PHP-3.01
BuildRequires: pkgconfig(libsodium) >= 1.0.9 BuildRequires: pkgconfig(libsodium) >= 1.0.9
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
@ -568,7 +569,7 @@ low-level PHP extension for the libsodium cryptographic library.
%package ffi %package ffi
Summary: Foreign Function Interface Summary: Foreign Function Interface
License: PHP License: PHP-3.01
Group: System Environment/Libraries Group: System Environment/Libraries
BuildRequires: pkgconfig(libffi) BuildRequires: pkgconfig(libffi)
Requires: php-common%{?_isa} = %{version}-%{release} Requires: php-common%{?_isa} = %{version}-%{release}
@ -603,7 +604,7 @@ help
%patch -P7 -p1 -b .ldap_r %patch -P7 -p1 -b .ldap_r
%patch -P8 -p1 -b .phpinfo %patch -P8 -p1 -b .phpinfo
%patch -P9 -p1 -b .datetests %patch -P9 -p1 -b .datetests
%patch -P10 -p1 -b .gh14480
cp Zend/LICENSE ZEND_LICENSE cp Zend/LICENSE ZEND_LICENSE
cp TSRM/LICENSE TSRM_LICENSE cp TSRM/LICENSE TSRM_LICENSE
@ -1331,6 +1332,10 @@ systemctl try-restart php-fpm.service >/dev/null 2>&1 || :
%{_mandir}/* %{_mandir}/*
%changelog %changelog
* Wed Jun 12 2024 Funda Wang <fundawang@yeah.net> - 8.3.8-2
- Fix GH-14480 Method visibility issue introduced in version 8.3.8
- Update licenses declaration
* Fri Jun 07 2024 Funda Wang <fundawang@yeah.net> - 8.3.8-1 * Fri Jun 07 2024 Funda Wang <fundawang@yeah.net> - 8.3.8-1
- New version 8.3.8 - New version 8.3.8