Bug #76700 [NEW]: false-positive "Error: Call to protected method" when using trait aliases
| From: | nicolas dot grekas+php at gmail dot com | Date: | Fri, 03 Aug 2018 15:36:13 +0000 |
| Subject: | Bug #76700 [NEW]: false-positive "Error: Call to protected method" when using trait aliases | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-216563@lists.php.net to get a copy of this message | ||
From: nicolas dot grekas+php at gmail dot com
Operating system:
PHP version: 7.3.0beta1
Package: Scripting Engine problem
Bug Type: Bug
Bug description:false-positive "Error: Call to protected method" when using trait aliases
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 bug report at https://bugs.php.net/bug.php?id=76700&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76700&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76700&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76700&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76700&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76700&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76700&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76700&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76700&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76700&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76700&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76700&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76700&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76700&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76700&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76700&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76700&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76700&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76700&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76700&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76700&r=mysqlcfg