The default configuration file, sites/default/default.settings.php, calls ini_set('magic_quotes_runtime', 0). This gives the impression that the user may actually change this setting, but doing this severely breaks Drupal and fubars the database (recovery seems hard).

To prevent users from making this mistake I suggest moving this setting out of the configuration file and into bootstrap.inc. I don't think it should be put in .htaccess, because this only works with Apache.

Comments

c960657’s picture

StatusFileSize
new4.25 KB

ini_set() moved to drupal_initialize_variables(), following the convention introduced in #304924: Extend drupal_error_handler to manage exceptions.

dries’s picture

Status: Needs review » Needs work

The new code comments in sites/default/default.settings.php don't seem to wrap at the same width ad the old ones. Quick reroll?

c960657’s picture

StatusFileSize
new4.46 KB

Now the whole paragraph is wrapped at 80 characters (webchick recommends this in her code reviews, though I couldn't find mention of this on drupal.org), with a newline following the URL to avoid punctuation. Parts of the file is already wrapped at 80 characters, though the indentation varies from paragraph to paragraph. I can rewrap the whole file if you like.

Related issue: #303154: Document ini_set() calls in default.settings.php

c960657’s picture

Status: Needs work » Needs review
StatusFileSize
new4.51 KB

Chasing HEAD.

dries’s picture

The only disadvantage I see is that magic_quotes are disabled much later in the process, and therefore we might have opened up a security issue. Are any hooks being called before magic quotes are set?

c960657’s picture

StatusFileSize
new7.48 KB

AFAICT magic_quotes_runtime are now called earlier in the bootstrap process than before - see the attached Xdebug function trace. Or did I misunderstand you?

I tried enabling magic_quotes_runtime in .htaccess and the ran the complete test suite - all tests pass.

Status: Needs review » Needs work

The last submitted patch failed testing.

c960657’s picture

Status: Needs work » Needs review
catch’s picture

Category: feature » bug
Status: Needs review » Reviewed & tested by the community

Patch looks good and c960657 is right about bootstrap ordering.

dries’s picture

Status: Reviewed & tested by the community » Fixed

c960657, you're absolutely right about the bootstrap ordering. Sorry to distract us. Committed this patch to CVS HEAD. Keep up the good work.

gpk’s picture

Component: base system » documentation
Status: Fixed » Reviewed & tested by the community
StatusFileSize
new1.66 KB

Minor docs cleanup including runtime/non-runtime confusion in bootstrap.inc.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the comment clean-up! I committed as is, but I changed:

+  // Don't escape quotes when reading files from database/disk etc.

to:

+  // Don't escape quotes when reading files from the database, disk, etc.
gpk’s picture

Ooh you are a stickler :P :)

webchick’s picture

I try. ;)

Thanks for the clean-up jobs you've been doing though, I really appreciate it! It's important that our comments stay as squeaky clean as our code. :)

gpk’s picture

>Thanks for the clean-up jobs you've been doing though
All 2 of them .. Some people are easy to please :D

Status: Fixed » Closed (fixed)

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