As part of all of the changes to the routing system we've made global $script_path obsolete. The only usages are in tests yet we assign it in every request.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug because the global $script_path should not be used.
Prioritized changes This is a followup of all the work on the url() and l().
Disruption Contrib will have to change it is using $script_path but it should not be and by fixing this code becomes more testable.

Comments

dawehner’s picture

Just an idea.

Instead of having the same kind of code twice, what about providing a method in our own variant of the routing context?

dawehner’s picture

StatusFileSize
new4.25 KB

Let's better replace all the usages of $script_path

Status: Needs review » Needs work

The last submitted patch, 2: 2426495-2.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new5.25 KB
new1.01 KB

Alright, one less problem.

Crell’s picture

#4seems good to me, and the diffstats go the right direction. :-)

fabianx’s picture

Status: Needs review » Reviewed & tested by the community

RTBC, looks great to me.

alexpott’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new5.27 KB

Rerolled because #2426489: Remove request_uri() landed and we still need a CR.

dawehner’s picture

Issue tags: -Needs change record

Added one. Do you think this is back to RTBC?

tstoeckler’s picture

Would be awesome to mention in which cases specifically the first example doesn't work and what the specific difference between the two is.

dawehner’s picture

I just realized that $script_path is something which just exists for 8.0.x ... so do we really think we need a change record?

Crell’s picture

Status: Needs review » Reviewed & tested by the community

And back.

I don't think $script_path was ever part of an API in D8, so if it didn't exist prior then there's no need for a CR.

webchick’s picture

Status: Reviewed & tested by the community » Needs review

This seems fine, other than:

+++ b/core/modules/system/src/Tests/Path/UrlAlterFunctionalTest.php
@@ -87,8 +88,7 @@ function testUrlAlter() {
+    $final = Url::fromUserInput('/' . $final)->toString();

This is not user input. Should we replace with an explicit internal:// instead? Or do we not care, since this is "just" a test?

dawehner’s picture

StatusFileSize
new5.27 KB
new866 bytes

I think think internal:// is the WORST thing we ever came up with, anyway, let's use it.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Back to RTBC

webchick’s picture

Status: Reviewed & tested by the community » Fixed

I know, sorry. :(

Committed and pushed to 8.0.x. Thanks!

  • webchick committed cbcf272 on
    Issue #2426495 by dawehner, alexpott: Remove the global $script_path
    

Status: Fixed » Closed (fixed)

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