Skip to content

Random Container class name generation fail #20489

@alexglue

Description

@alexglue

Kernel class method getName(){} has a schroedinger-bug:
when working directory starts with number, generated class has invalied php name:

pwd (root dir is): 112bgf3892d (like name, generated in teamcity etc)

fix:

        public function getName()
        {
            if (null === $this->name)
            {
                //[-] $this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir));
                //[+] $this->name = 'app' . preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir));
            }

            return $this->name;
        }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions