When scanning files for classes to be available for autoloading, _registry_parse_file() will ignore perfectly valid classes defined as final. So for example, the registry will pick up

class NodeController extends DrupalDefaultEntityController {

but if it were ever changed to

final class NodeController extends DrupalDefaultEntityController {

then the registry would ignore it. As of my last grep, core does not include any final classes, but I'm marking this critical because it could cause very odd, confusing blow-ups in contrib if not dealt with. The attached patch fixes the relevant regex.

CommentFileSizeAuthor
final_classes_in_registry.patch721 bytessdboyer
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

grendzy’s picture

Status: Needs review » Reviewed & tested by the community

makes sense to me.

chx’s picture

Before someone asks, what else can be there here are lines 329-333 from PHP 5.3 grammar:

class_entry_type:
                T_CLASS                 { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = 0; }
        |       T_ABSTRACT T_CLASS { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; }
        |       T_FINAL T_CLASS { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = ZEND_ACC_FINAL_CLASS; }
;

So now we are done. (interfaces can't have any of this)

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.