Problem/Motivation

Original discovered in #2380389-169: Use a single vendor directory in the root.

rebuild.php bypasses autoload.php and includes core/vendor/autoload.php directly.

Proposed resolution

Add test coverage for rebuild.php similar to \Drupal\system\Tests\Update\UpdateScriptTest.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

webflo created an issue. See original summary.

mile23’s picture

Check out my comment here: https://www.drupal.org/node/2380389#comment-10376025

rebuild.php needs more than tests, IMO, so that we can rely on behavior from different systems that need to deal with the cache.

hussainweb’s picture

Status: Active » Needs review
StatusFileSize
new417 bytes

Just the first step. Tests pending.

jibran’s picture

webflo’s picture

StatusFileSize
new1.45 KB
webflo’s picture

StatusFileSize
new1.44 KB

The last submitted patch, 5: 2575267-5.patch, failed testing.

The last submitted patch, 5: 2575267-5.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 6: 2575267-6.patch, failed testing.

The last submitted patch, 6: 2575267-6.patch, failed testing.

kgoel’s picture

Status: Needs work » Needs review
StatusFileSize
new9.85 KB
new8.41 KB

while debugging RebuildScriptTest.php and found that cURL used to handle URLs with a fragment by including fragment in the request to the server which has been fixed in cURL 7.20 so I have reverted https://www.drupal.org/node/671520 in this patch. It could be separate out in different issue if removal of more than 5 year code is out of scope in this issue.

Status: Needs review » Needs work

The last submitted patch, 11: 2575267-11.patch, failed testing.

kgoel’s picture

tstoeckler and I were looking at it together. We couldn't find any instance of cURL handling fragments in the URL. We thought about it and we are considering to remove the cURL redirect handling from core and revert #11patch and re-add custom handling of fragments in Drupal way.

The last submitted patch, 11: 2575267-11.patch, failed testing.

kgoel’s picture

Status: Needs work » Needs review
StatusFileSize
new2.28 KB
new1.52 KB

tstoeckler and I were looking at it together. We couldn't find any instance of cURL handling fragments in the URL. We thought about it and we are considering to remove the cURL redirect handling from core and revert #11patch and re-add custom handling of fragments in Drupal way.

Worked off of #6patch and posting what I have so far.

kgoel’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 15: 2575267-15.patch, failed testing.

The last submitted patch, 15: 2575267-15.patch, failed testing.

webchick’s picture

Priority: Normal » Major

This is a big deal. We almost committed the wrong class load path in #2380389: Use a single vendor directory in the root due to lacking this test coverage.

webflo’s picture

Status: Needs work » Needs review
StatusFileSize
new1.63 KB
webflo’s picture

+++ b/core/rebuild.php
@@ -53,4 +53,4 @@
+header('Location: ' . $request->getSchemeAndHttpHost() . $base_path);

Assertions on redirects without scheme and hostname are completely broken in Simpletest

mile23’s picture

Status: Needs review » Reviewed & tested by the community

Patch still applies, the test runs and passes. Just one thing...

+++ b/core/modules/system/src/Tests/Update/RebuildScriptTest.php
@@ -0,0 +1,45 @@
+    $cache = \Drupal::cache();

Should be $this->container->get('cache.default');, fixable on commit, or ignorable given that we're not consistently using the fixture anyway.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 20: 2575267-20.patch, failed testing.

mile23’s picture

Re-running the test because it's unclear whether the failing test was unrelated.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mile23’s picture

Issue tags: +Kill includes
+++ b/core/modules/system/src/Tests/Update/RebuildScriptTest.php
@@ -0,0 +1,45 @@
+class RebuildScriptTest extends WebTestBase {

Needs to not be a WebTestBase test.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

MerryHamster’s picture

StatusFileSize
new1.67 KB
new545 bytes

Patch for 8.6.x and fixed #22

MerryHamster’s picture

Version: 8.5.x-dev » 8.6.x-dev
Status: Needs work » Needs review
MerryHamster’s picture

StatusFileSize
new1.67 KB
new545 bytes

oops, forgot to change version.
Adding again. Patch for 8.6.x and fixed #22

The last submitted patch, 31: 2575267-31.patch, failed testing. View results

andypost’s picture

+++ b/core/modules/system/src/Tests/Update/RebuildScriptTest.php
@@ -0,0 +1,45 @@
+    $this->drupalGet(Url::fromUri('base:core/rebuild.php'));
...
+    $this->drupalGet(Url::fromUri('base:core/rebuild.php'));

+++ b/core/rebuild.php
@@ -54,4 +54,4 @@
-header('Location: ' . $base_path);
+header('Location: ' . $request->getSchemeAndHttpHost() . $base_path);

not all cases covered

missing schemaAndHost

dawehner’s picture

+++ b/core/modules/system/src/Tests/Update/RebuildScriptTest.php
@@ -0,0 +1,45 @@
+class RebuildScriptTest extends WebTestBase {

Let's directly with extensing BrowserTestBase. Please ask if you need some help.

borisson_’s picture

Status: Needs review » Needs work

Setting to needs work based on #36.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

voleger’s picture

Status: Needs work » Needs review
StatusFileSize
new2.24 KB
new1.64 KB

Status: Needs review » Needs work

The last submitted patch, 39: 2575267-39.patch, failed testing. View results

voleger’s picture

StatusFileSize
new484 bytes
new1.65 KB
voleger’s picture

Status: Needs work » Needs review
mile23’s picture

Patch still applies, re-running test.

mile23’s picture

Status: Needs review » Reviewed & tested by the community

Test in #41 tests these things:

  • That caches aren't cleared without the rebuild_access permission.
  • That caches are cleared with the rebuild_access permission.
  • That rebuild.php redirects to the front page.

It'd be great if it had inline comments to say all that. But that's a nit.

Re: #19 - I'm not sure how we'd test for using the wrong autoload.php file, other than token analysis. That seems like a long way to go for something we don't do on other scripts.

And, for the record, I ran the test in #41 after modifying rebuild.php to require vendor/autoload.php. It passed.

RTBC here so we can have some coverage rather than perfect coverage.

alexpott’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Committed and pushed a3270cd3d1 to 8.7.x. Thanks!

I agree with @Mile23 some test coverage is better than none.

  • alexpott committed a3270cd on 8.7.x
    Issue #2575267 by webflo, kgoel, voleger, MerryHamster, hussainweb,...

Status: Fixed » Closed (fixed)

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