Bug #78895 [Ver->Csd]: Reflection detects abstract non-static class as abstract static

From: Date: Mon, 09 Dec 2019 10:50:54 +0000
Subject: Bug #78895 [Ver->Csd]: Reflection detects abstract non-static class as abstract static
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224165@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78895&edit=1

 ID:                 78895
 Updated by:         dmitry@php.net
 Reported by:        abashurov at plesk dot com
 Summary:            Reflection detects abstract non-static class as
                     abstract static
-Status:             Verified
+Status:             Closed
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   All
 PHP Version:        7.4.0
 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=42a2fb8411848236d0cd56b5efd05e352e62ee3d
Log: Fixed bug #78895 (Reflection detects abstract non-static class as abstract static.
IS_IMPLICIT_ABSTRACT is not longer used)


Previous Comments:
------------------------------------------------------------------------
[2019-12-09 10:04:44] dmitry@php.net

May be fixed by https://gist.github.com/dstogov/0321d27b7970692484a4de6ad5089273

------------------------------------------------------------------------
[2019-12-02 09:53:42] abashurov at plesk dot com

Running bisect also points to this commit:
$ git bisect bad
0fbd2e6a168a5cfacec6c44f4c179879a52428f3 is the first bad commit
commit 0fbd2e6a168a5cfacec6c44f4c179879a52428f3
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue Sep 11 17:21:17 2018 +0300

    Renumber ZEND_ACC_... flags

------------------------------------------------------------------------
[2019-12-02 09:04:08] cmb@php.net

Commit 0fbd2e6[1] renumbered the ZEND_ACC_* flags, and now
ZEND_ACC_IMPLICIT_ABSTRACT_CLASS has the same value as
ZEND_ACC_STATIC.  The former is set, because the class has an
abstract method; if it had not, results would be correct[2].

Dmitry, could you please have a look?

[1] <http://git.php.net/?p=php-src.git;a=commit;h=0fbd2e6a168a5cfacec6c44f4c179879a52428f3>
[2] <https://3v4l.org/qDEpu>

------------------------------------------------------------------------
[2019-12-02 08:13:01] abashurov at plesk dot com

Description:
------------
Initially reproduced on Arch Linux and Windows Server 2016:

php -v
PHP 7.4.0 (cli) (built: Nov 30 2019 10:43:49) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies
    with Xdebug v2.8.0, Copyright (c) 2002-2019, by Derick Rethans

php.exe -v
PHP 7.4.0 (cli) (built: Nov 27 2019 10:13:59) ( NTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies



As 3v4l shows, this behavior is exclusive to PHP 7.4: https://3v4l.org/rEqh2

Test script:
---------------
<?php
abstract class Foo
{
    abstract public function Bar();
}

$ref = new ReflectionClass(Foo::class);
var_dump(Reflection::getModifierNames($ref->getModifiers()));

Expected result:
----------------
Calling getModifiers on a non-static class does not detect it as static

Actual result:
--------------
Calling getModifiers on a non-static class detects it as static


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=78895&edit=1


Thread (5 messages)

« previous php.bugs (#224165) next »