Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Note: Tagging this as "base system" because I seem to remember that "documentation" is not used in the core queue.
Problem description
drupal_bootstrap() give s a useful reference for external scripts on how to bootstrap Drupal. After #1540136: Simplify index.php by moving DRUPAL_ROOT to bootstrap.inc following this documentation will lead to a PHP error, however.
Proposed resolution
Instead of saying:
* define('DRUPAL_ROOT', '/path/to/drupal');
* require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
* drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
we should say
* require_once '/path/to/drupal/core/includes/bootstrap.inc';
* drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
Because bootstrap.inc now defines DRUPAL_ROOT and defining the same constant twice leads to a PHP error.
Comment | File | Size | Author |
---|---|---|---|
#5 | documentation_drupal_bootstrap-2056845-5.patch | 564 bytes | StephaneQ |
Comments
Comment #1
longwaveIn your suggestion DRUPAL_ROOT is still used but will not be defined. This should be something like:
Comment #2
tstoecklerSorry, it's late here.
Obviously,
does not work as DRUPAL_ROOT is defined in bootstrap.inc. #fail
Updated the issue summary accordingly.
Comment #3
tstoecklerOops, that was a crosspost. Yeah...
Comment #3.0
tstoecklerUpdated issue summary.
Comment #4
chx CreditAttribution: chx commentedIt is definitely used in the core queue.
Comment #4.0
chx CreditAttribution: chx commentedUpdated issue summary.
Comment #5
StephaneQComment #6
chx CreditAttribution: chx commentedThat looks good.
Comment #6.0
chx CreditAttribution: chx commentedUpdated issue summary.
Comment #7
webchickNice catch.
Committed and pushed to 8.x. Thanks!
Comment #8.0
(not verified) CreditAttribution: commentedrewritten issue summary