Skip to content

Incompatibility between extension hook on Director::absoluteBaseURL() and _config.php #10292

@emteknetnz

Description

@emteknetnz

Discovered during #10291

Adding an extension hook to Director::absoluteBaseURL() caused a number of strange issues when running unit tests in CI when there was a module present, namely cwp/cwp, which contains an old fashioned _config.php file that calls Director::absoluteBaseURL()

(this following was my understanding from memory, it may not be completely accurate)
This ends up causing the manifest to be created twice, which normally wouldn't be a problem, but the manifest cache (an array property on a class) is not respected as there are 2 'surrounding classes' so there ends up being two sets of service classes (%$ references) being created, which is clearly wrong since they are supposed to be singletons.

The following steps should replicate the issue and give enough direction for further investigation:

private $rand = null;
public function __construct() { $this->rand = rand(0,10000); }
  • Run the unit test HTTPCacheControlIntegrationTest::testFormCSRF
  • When stopping the breakpoint, $this->rand should show 2 different numbers on subsequent passes, indicated that there's been 2 different singletons created.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions