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
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 2938209-02.patch | 386 bytes | jhedstrom |
Comments
Comment #2
jhedstromComment #3
anavarreI didn't observe that.
And when hitting the script via the browser, I'm successfully redirected:
How can I reproduce?
Comment #4
borisson_I also can't reproduce this.
Comment #5
jhedstromI think this might be OS-specific. It doesn't happen on centos, but does running on OSX.
From the root directory, not
core:still results in:
Comment #6
borisson_If I understand #5 correctly this only happens on OSX for you?
If I run
$ php core/rebuild.phpon my machine (also OSX), I don't get any errors. For giggles, I ssh'd into a debian box and no errors there either.Comment #7
jhedstromI 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.
Comment #8
borisson_I've tried this with different versions of php (5.6, 7.0, 7.1) but I can't reproduce this.
Comment #9
jhedstromIt no longer happens for me locally, but it still may be good to add the
__DIR__constant into thechdircall. That way there's no ambiguity for whatever combination of OS/filesystem/php version does cause this.Comment #15
johnnny83 commentedI have the same problem on a debian server
Comment #18
smustgrave commentedThis 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.