Bug #77613 [Asn->Csd]: method visibility change

From: Date: Thu, 14 Feb 2019 10:18:55 +0000
Subject: Bug #77613 [Asn->Csd]: method visibility change
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219574@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: dmitry@php.net Reported by: gstachniuk at gmail dot com Summary: method visibility change -Status: Assigned +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: Ubuntu 18.04.1 LTS PHP Version: Next Minor Version Assigned To: dmitry Block user comment: N Private report: N New Comment: Automatic comment on behalf of dmitry@zend.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=43a7d95016761787cace63fb52e93e27e123d0cc Log: Fixed bug #77613 (method visibility change) (reverted ZEND_ACC_CTOR and ZEND_ACC_DTOR flags removal) Previous Comments: ------------------------------------------------------------------------ [2019-02-13 13:32:36] nikic@php.net @dmitry: Can you please take a look at this? This is easy enough to fix by checking constructor on the actual parent CE rather than common.scope, but I'm wondering if we shouldn't bring back ZEND_ACC_CTOR. The premise was that it can be replaced by a fe->common.scope->constructor == fe check, but this is not the case. ------------------------------------------------------------------------ [2019-02-13 13:23:53] nikic@php.net 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. ------------------------------------------------------------------------ [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 (#219574) next »