Bug #76700 [Ver->Csd]: false-positive "Error: Call to protected method" when using trait aliases
| From: | laruence@php.net | Date: | Tue, 07 Aug 2018 06:24:25 +0000 |
| Subject: | Bug #76700 [Ver->Csd]: false-positive "Error: Call to protected method" when using trait aliases | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-216650@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76700&edit=1
ID: 76700
Updated by: laruence@php.net
Reported by: nicolas dot grekas+php at gmail dot com
Summary: false-positive "Error: Call to protected method"
when using trait aliases
-Status: Verified
+Status: Closed
Type: Bug
Package: Scripting Engine problem
PHP Version: 7.3.0beta1
Assigned To: pmmaga
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of mail@pmmaga.net
Revision: http://git.php.net/?p=php-src.git;a=commit;h=887235773d1848108f842184c978ba37875768f2
Log: Fix #76700 - Methods with altered visibility need to be added again
Previous Comments:
------------------------------------------------------------------------
[2018-08-05 22:08:39] cmb@php.net
For reference: <https://github.com/php/php-src/pull/3426>.
------------------------------------------------------------------------
[2018-08-03 15:36:13] nicolas dot grekas+php at gmail dot com
Description:
------------
See test script, or https://3v4l.org/Tti7T
Works on PHP < 7.3
Test script:
---------------
<?php
trait T1
{
protected function aa() { echo 123; }
}
trait T2
{
use T1 {
aa as public;
}
}
class A
{
use T1;
}
class B extends A
{
use T2;
}
$b = new B();
$b->aa();
Expected result:
----------------
123
Actual result:
--------------
Fatal error: Uncaught Error: Call to protected method A::aa() from context ''
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76700&edit=1