Problem/Motivation

Running php core/rebuild.php from the Drupal root directory currently fails with:

Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: The service file "core/core.services.yml" is not valid.

this is because the first line of the script changes directory:

// Change the directory to the Drupal root.
chdir('..');

assuming the script is being run from the core directory.

Proposed resolution

Add the __DIR__ magic constant to the chdir() call.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 2938209-02.patch386 bytesjhedstrom

Comments

jhedstrom created an issue. See original summary.

jhedstrom’s picture

Status: Active » Needs review
StatusFileSize
new386 bytes
anavarre’s picture

I didn't observe that.

$ php core/rebuild.php 
$

And when hitting the script via the browser, I'm successfully redirected:

203.0.113.2 - - [20/Jan/2018:13:36:42 +0000] "GET /core/rebuild.php HTTP/1.0" 302 182 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"
203.0.113.2 - - [20/Jan/2018:13:36:42 +0000] "GET / HTTP/1.0" 200 5826 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"

How can I reproduce?

borisson_’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

I also can't reproduce this.

jhedstrom’s picture

Status: Needs work » Needs review

I think this might be OS-specific. It doesn't happen on centos, but does running on OSX.

From the root directory, not core:

$> php core/rebuild.php

still results in:

Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: The service file "core/core.services.yml" is not valid.
borisson_’s picture

If I understand #5 correctly this only happens on OSX for you?

If I run $ php core/rebuild.php on my machine (also OSX), I don't get any errors. For giggles, I ssh'd into a debian box and no errors there either.

jhedstrom’s picture

I wonder if it's php-version specific too (tested on both 7.0 and 7.1 on osx and reproduced the issue)... fwiw, I don't actually use this script, I use drush, I just happened to notice the issue when trying to assist somebody who didn't have drush installed.

borisson_’s picture

I've tried this with different versions of php (5.6, 7.0, 7.1) but I can't reproduce this.

jhedstrom’s picture

It no longer happens for me locally, but it still may be good to add the __DIR__ constant into the chdir call. That way there's no ambiguity for whatever combination of OS/filesystem/php version does cause this.

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

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should 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.

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

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

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

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev
johnnny83’s picture

I have the same problem on a debian server

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

Did not test.

But moving to NW for the issue summary requested in #4. Also imagine this will need a test case to show the issue.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.