Bug #77613 [Asn]: method visibility change

From: Date: Wed, 13 Feb 2019 13:23:53 +0000
Subject: Bug #77613 [Asn]: method visibility change
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219556@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77613&edit=1 ID: 77613 Updated by: nikic@php.net Reported by: gstachniuk at gmail dot com Summary: method visibility change Status: Assigned Type: Bug Package: Scripting Engine problem Operating System: Ubuntu 18.04.1 LTS PHP Version: Next Minor Version Assigned To: nikic Block user comment: N Private report: N New Comment: Here is another reproducer: class A { public function __construct() { static $foo; } } class B extends A { } class C extends B { private function __construct() {} } The important bit is that a) we have an intermediate class that inherits the ctor b) the ctor is duplicated. In the original example this is due to an internal class, in this example due to use of static variables. The reason why this issue occurs is that "parent->common.scope->constructor == parent" is used to detect a constructor. However, if parent comes from class B then parent->common.scope will be A, which has a different instance of the same constructor. Previous Comments: ------------------------------------------------------------------------ [2019-02-13 12:31:01] gstachniuk at gmail dot com Description: ------------ in php version 7.4 I can not change methods visibility anymore. Test script: --------------- class CustomException extends \RuntimeException { private function __construct(string $msg) { return new self($msg); } } Expected result: ---------------- no error message ``` ::__construct() must be public (as in class Exception) in ``` ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77613&edit=1

« previous php.bugs (#219556) next »