mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3'
* PHP-8.3: Fix GH-14480: Method visibility issue introduced in version 8.3.8 (#14484)
This commit is contained in:
60
Zend/tests/gh14480.phpt
Normal file
60
Zend/tests/gh14480.phpt
Normal file
@@ -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
|
||||||
@@ -2021,12 +2021,14 @@ static void zend_add_trait_method(zend_class_entry *ce, zend_string *name, zend_
|
|||||||
if (check_inheritance) {
|
if (check_inheritance) {
|
||||||
/* Inherited members are overridden by members inserted by traits.
|
/* Inherited members are overridden by members inserted by traits.
|
||||||
* Check whether the trait method fulfills the inheritance requirements. */
|
* 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(
|
do_inheritance_check_on_method(
|
||||||
fn, fixup_trait_scope(fn, ce), existing_fn, fixup_trait_scope(existing_fn, ce),
|
fn, fixup_trait_scope(fn, ce), existing_fn, fixup_trait_scope(existing_fn, ce),
|
||||||
ce, NULL,
|
ce, NULL, flags);
|
||||||
ZEND_INHERITANCE_CHECK_PROTO | ZEND_INHERITANCE_CHECK_VISIBILITY |
|
|
||||||
ZEND_INHERITANCE_SET_CHILD_CHANGED| ZEND_INHERITANCE_SET_CHILD_PROTO |
|
|
||||||
ZEND_INHERITANCE_RESET_CHILD_OVERRIDE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|||||||
Reference in New Issue
Block a user