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.
Problem:
If the PHP configuration has magic_quotes_gpc set to On, then drush commands fail with the following error:
PHP's 'magic_quotes_gpc' and 'magic_quotes_runtime' settings are not supported and must be disabled.Drush command terminated abnormally due to an unrecoverable error. [error]
Some pre-built environments (notably MAMP) default to magic_quotes_gpc = On
. To make things even more difficult, some MAMP environments seem to ignore -d and ini_set for magic_quotes_gpc
, and only seem to respond to changes in php.ini.
Suggested Workaround(s):
- Explicitly set all
magic_quotes_*
settings toOff
in php.ini - Explicitly set all
magic_quotes_*
settings toOff
in drush.ini - Explicitly set all
magic_quotes_*
settings to0
in php.ini - Explicitly set all
magic_quotes_*
settings to0
in drush.ini
Suggested Improvement:
Find some way for drush to consistently force magic_quotes_gpc = Off
. If we cannot force it off on some platforms, identify what it is about those platforms and update the documentation to match.
Comments
Comment #1
boran CreditAttribution: boran commentedInteresting, I also got hit by this at dc munich during the sprint :-)
Probably due something to D8. Don't get that warning for d7.
I disabled gpc options in /etc/php.ini, and /Applications/MAMP/bin/php/php5.3.6/conf/php.ini
see #532818 which explains to use php --ini to find which ini file is being used.
Comment #2
greg.1.anderson CreditAttribution: greg.1.anderson commentedI believe that the message shown in #0 is the result of Drush showing all of the watchdog messages (did not explicitly try to reproduce this, though). It would be hard for Drush to parse the Drupal error message for the purpose of enhancing them, but one thing that we could do is deny
magic_quotes_gpc
andmagic_quotes_runtime
in Drush, before we try to bootstrap Drupal. With the attached patch, Drush will then print out the following message:This patch does this invariantly, not just for Drupal 8. I presume that this is okay (i.e., there is no reason why someone would need to run with these settings enabled).
Comment #3
blackra CreditAttribution: blackra commentedThis patch appears to solve the problem by allowing drush to get far enough to print out its php.ini path.
Since I'm new to Drupal and this was my first experience of applying a patch, I think somebody else should look at it too...
Comment #4
blackra CreditAttribution: blackra commentedBTW, that should have explicitly said I tested it and it looks good to me.
Comment #5
Cameron Tod CreditAttribution: Cameron Tod commentedTested locally, and still applies cleanly to the 8.x-6.x and 7.x-5.x branches, and allows for a very useful error message.
Comment #6
greg.1.anderson CreditAttribution: greg.1.anderson commentedCommitted to 8.x-6.x and 7.x-5.x. Thanks.
Comment #8
moshe weitzman CreditAttribution: moshe weitzman commentedPerhaps we could do better here? I'm thinking that the bash script `drush` could always add magic_quotes_gpc=Off when it executes drush.php
Comment #9
moshe weitzman CreditAttribution: moshe weitzman commentedI'm come across this message twice in a week so thats why its on my mind.
Comment #10
greg.1.anderson CreditAttribution: greg.1.anderson commentedThis setting is deprecated in php 5.3, and removed in 5.4. Do we really want to explicitly turn it off on every call? Since magic_quotes_gpc=on seems like such an imprudent setting, I'm surprised that it defaults to on so commonly. All the same, I am reluctant to hardcode this in the drush script unless
it is causing serious problems... well, I'm not sure unless what. Unless everyone feels strongly that we should, I guess.http://php.net/manual/en/security.magicquotes.php
Comment #11
moshe weitzman CreditAttribution: moshe weitzman commentedI don't see why not. we are currently forcing users to do exactly that with a drush.ini file. They get lost with that process. There is no performance impact so why not? It isn't like we are affecting other php requests.
Comment #12
greg.1.anderson CreditAttribution: greg.1.anderson commentedI considered removing all of the mode testing in _drush_environment_check_php_ini(), and adding a define to disable each of these options on the commandline, just as is done with magic_quotes, but somehow felt that wasn't quite appropriate. There is no protection in drush.bat, and some folks may still be using the deprecated technique
alias drush=php ... drush.php
. So I kept it simple.Comment #13
Sam MooreHope this isn't too tangential, but I'm putting it here in case it might help someone.
In getting drush for D8 going under MAMP, I ran into the magic_quotes warnings, and found that setting all the magic_quotes values to "Off" didn't help.
I had to put the following in a drush.ini to make drush happy:
magic_quotes_gpc = 0
magic_quotes_runtime = 0
magic_quotes_sybase = 0
If this belongs somewhere else, please kindly let me know.
Cheers
Comment #14
greg.1.anderson CreditAttribution: greg.1.anderson commentedCommitted to 8.x-6.x.
Comment #16
greg.1.anderson CreditAttribution: greg.1.anderson commentedI guess this should have gone into 7.x-5.x. See: #1977626: magic_quotes_gpc and magic_quotes_runtime non-empty values
Comment #17
greg.1.anderson CreditAttribution: greg.1.anderson commentedAlways disable magic_quotes_gpc et. al. when launching Drush
Comment #18
greg.1.anderson CreditAttribution: greg.1.anderson commented#17 is a little simpler than what is currently in 8.x-6.x; if it works for folks on the 7.x-5.x branch, we could commit it both places.
I will commit to both branches in a couple of days if there are no comments.
Comment #19
jonhattanI've also suffered this warning just now. Patch in #17 solves it.
Updating issue priority since it is a regresion in 5.9.
Comment #20
greg.1.anderson CreditAttribution: greg.1.anderson commentedCommitted to 7.x-5.x, and also made the same simplification in 8.x-6.x.
Comment #21
greg.1.anderson CreditAttribution: greg.1.anderson commentedNote: if you feel inclined to re-open this issue because it breaks unit tests, please note that the issue in question actually dates back to #1332818: Shell aliases starting with a ! don't pass along options and arguments, which I have re-opened with a patch.
Comment #22
Anonymous (not verified) CreditAttribution: Anonymous commented#13 worked for me. MAMP PRO 2.1.2, PHP 4.3.20, Drush 5.9, Drupal 7.22
Comment #23
electrokate CreditAttribution: electrokate commented#13 worked for me too! Using MAMP PRO, Drush 5.9. Thank you so much! You guys rock. :)))
Comment #24
greg.1.anderson CreditAttribution: greg.1.anderson commentedIn theory, #13 is not necessary under the latest Drush 7.x-5.x-dev (but -is- helpful for Drush 5.9). Re-open if this is not the case, though.
Comment #25
xmacinfo@greg.1.anderson: Most users, like me, will use pear upgrade to a release version of Drush. So it might be easier to apply the patch than to install the dev version of Drush.
Comment #26
Jooblay.net CreditAttribution: Jooblay.net commentedWe upgraded from drush 5.6 to 5.9 on our LAMP stack and received this error. After looking at our php.ini file the Magic quotes were Off but ; commented out. By turning turning them off and removing the ; all is well.
Comment #27
fmilland CreditAttribution: fmilland commentedGot the same error
php.ini file at /Applications/MAMP/bin/php/php5.2.17/conf/php.ini was like this
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = On
; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off
; Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off
Changed it to
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off
; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off
; Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off
And error went away,
Any comments?
Comment #28
Jooblay.net CreditAttribution: Jooblay.net commentedYes #27 that did the trick for us.
Comment #29
conniemh CreditAttribution: conniemh commentedMy php.ini had all the magic_quotes settings set to "Off" but I was still getting that error message when running drush. There is another related thread for drush errors for versions used in D8, but I went ahead and took a chance and created a drush.ini file as instructed here. Worked like a charm.
This worked with a PHP version 5.3.19 and Drush version 5.9 (for D7)
Hope this helps others,
Connie Harich
Comment #30
pasive CreditAttribution: pasive commentedIn my /Applications/MAMP/bin/php/php5.3.6/conf/php.ini
I had magic_quotes_sybase = Off commented in, commented out the resolved the problem and disappearance of error messages.
Comment #31
John Bickar CreditAttribution: John Bickar commentedUgh, annoying MAMP.
In /Applications/MAMP/bin/php/php5.3.20/conf/php.ini I had:
I tried setting the following in drush.ini:
And still got the error.
The fix was to explicitly set magic_quotes_gpc to Off in php.ini:
(This is a MAMP problem, not a drush problem, IMO. Just documenting here in case someone else encounters the same issue.)
Comment #32
greg.1.anderson CreditAttribution: greg.1.anderson commentedDrush 8.x-6.x-dev, and Drush 7.x-5.x-dev both automatically set
magic_quotes_gpc=0
, notOff
. It would be helpful if folks who find that0
does not work for them, but thatOff
does could also try the latest dev version of Drush, and see if it solves their problems. If Drush needs to switch toOff
instead of0
, we should figure that out and fix it now. I understand the point in #25, but if no one has time to test dev, then the problem will persist 7.x-5.10.Comment #33
John Bickar CreditAttribution: John Bickar commentedSorry, forgot to add that: my comment in #31 was against 8.x-6.x-dev.
Comment #34
greg.1.anderson CreditAttribution: greg.1.anderson commentedGreat; that is helpful. Let's set status.
Comment #35
greg.1.anderson CreditAttribution: greg.1.anderson commentedPer #31 and http://www.php.net/manual/en/security.magicquotes.disabling.php, use "Off" instead of "0" for the various magic_quote settings.
Comment #36
John Bickar CreditAttribution: John Bickar commentedHesitant to set this to CNW because I still think it's a MAMP issue, and I have a workaround, but the patch does not solve my issue (with MAMP).
With patch applied, nothing in my drush.ini, and with the following in my php.ini for MAMP:
I get:
I'm running drush 6 through PHP 5.3.20 on MAMP:
When I change my php.ini for MAMP to:
I get:
(etc.)
And then
php -i
showsmagic_quotes_gpc = Off
:Comment #37
greg.1.anderson CreditAttribution: greg.1.anderson commentedIt's possible that this is a 'can not fix' for MAMP, if the -d values to php are somehow ignored. Let's leave this at 'needs work' for a while, though, and see if there are any MAMP users who can come up with a better solution.
If we can't fix is in the drush script, we can at least update the docs in the README about MAMP.
Comment #38
xmacinfoUsing the trick in #31 made Mamp work with Drush 7.x-5.9.
I did not try to force it using the ini_set('magic_quotes_gpc', 'off'); in the settings.php file, though. That might work.
Comment #39
greg.1.anderson CreditAttribution: greg.1.anderson commentedYes, this is fixable by changing your configuration settings; however, this issue is about whether we can make it possible to run without configuring settings by turning off magic_quotes_gpc & c. in the drush script, as php is called.
Comment #40
John Bickar CreditAttribution: John Bickar commentedI spent some time on the Googles this afternoon on this one, and the best I could come up with was this PHP bug, which says:
Unsurprisingly, my Google-fu fails to return meaningful results for "-d", and the above doesn't really answer Greg's question in #37 as to whether MAMP ignores the "-d" flag (which it appears to be doing, given the patch in #35).
So far, I see that we have a workaround (w00t!) but not closure.
The issue summary could use some refreshing (I'll try to hit this in tomorrow's sprint), and the patch in #35 could use testing on platforms other than MAMP (if those platforms are experiencing the same issue).
Comment #41
greg.1.anderson CreditAttribution: greg.1.anderson commentedIf
ini_set('magic_quotes_gpc', 'off');
works in settings.php, then Drush could call ini_set on these three properties first thing. ini_set does not work for some values after php has been launched, but it seems like an easy test someone could do.Comment #42
greg.1.anderson CreditAttribution: greg.1.anderson commentedLet's try to fix this with ini_set. If these values can be changed by ini_set, this is probably the most stable solution.
Comment #43
greg.1.anderson CreditAttribution: greg.1.anderson commentedSince so many people are posting here, we should probably make this a Release Blocker for Drush 6.
Comment #44
John Bickar CreditAttribution: John Bickar commentedSorry :(
Tested on MAMP with patch in #42, same results as in #36.
Comment #45
greg.1.anderson CreditAttribution: greg.1.anderson commentedThat's too bad. Maybe a documentation patch is the best we can do here for MAMP.
Comment #46
Cameron Tod CreditAttribution: Cameron Tod commentedIt seems ok here, without the patch:
This is against a45a79b.
Comment #47
greg.1.anderson CreditAttribution: greg.1.anderson commentedHere is our best-effort fix, plus a documentation patch to catch folks who still have troulbe with magic_* setting despite our attempts to disable them.
Comment #48
moshe weitzman CreditAttribution: moshe weitzman commentedCommitted to 5.x and 6.x. Thanks.
Comment #49
Jooblay.net CreditAttribution: Jooblay.net commentedGreat work:) means more then you I can ever express... @greg.1.anderson @moshe weitzman what is the best method to donate $cash to the drush project?
Comment #50
greg.1.anderson CreditAttribution: greg.1.anderson commentedI would think that the best thing to do would be to make a donation to the Drupal Association. If enough people donated, then perhaps they could sponsor a Drush sprint in the future. If just a few people are donating, though, perhaps it is best to not earmark it, and just thank the whole community through the DA. Kind words go a long way too, so thanks!
Comment #51
geerlingguy CreditAttribution: geerlingguy commentedI upgraded to 7.x-5.9 and then to 8.x-6.x (latest checkout from git), and I still had too add the following before the errors went away; I was using MAMP, and couldn't find any php.ini that was enabling any of the values (all were
Off
. The error didn't come up until I upgraded MAMP, and with it, 5.3.14 to 5.3.20. Weird.(I added the above code block to the bottom of 'drush.ini', which I copied from 'example.drush.ini' in the drush installation folder to my username/.drush folder.)
Comment #52
greg.1.anderson CreditAttribution: greg.1.anderson commentedSeems folks are using drush.ini as a basis for getting Drush to work on MAMP.
See: http://workingmatt.blogspot.co.uk/2013/05/using-drush-to-sync-live-and-d...
We should add magic_ settings to this file and make it all ready for drop-in use.
Comment #53
Jooblay.net CreditAttribution: Jooblay.net commented:) absolutely agree... will fire the rockets and motivate more donations:)
We are LAMP strapped so I can not speak to the MAMP but it seems magic_quotes are packed uncommented and Off. Which is why we ran across this issue off a modified php.ini file.
Thanks to everyone for all their hard work... it truly inspires another conciousness...
Comment #54
greg.1.anderson CreditAttribution: greg.1.anderson commentedHere is some better documentation for drush.ini.
Comment #55
ShaunDychko CreditAttribution: ShaunDychko commentedWell, I tried most of the above without success since I think there is an extra quirkiness with the PRO version of MAMP. I'm on Mac OSX Lion 10.8.3, MAMP 2.1.4 PRO, Drush 5.9. I think the reason I needed a different solution is because I was making changes to php.ini through the
File -> Edit Template -> PHP -> PHP 5.3.20 php.ini
menu provided by MAMP PRO. This php.ini file (which I suppose is dynamically generated by MAMP after making changes to the 'template'), according to phpinfo() resides in/Library/Application Support/appsolute/MAMP PRO/conf/php.ini
, but drush wasn't picking this up. Drush was instead using, quite sensibly since I have/Applications/MAMP/bin/php/php5.3.20/bin
in my PATH variable, the php.ini file located at/Applications/MAMP/bin/php/php5.3.20/conf/php.ini
. This file, however, doesn't contain any of the changes made through the MAMP PRO edit template menu! Furthermore, it doesn't contain anything aboutmagic_quotes_gpc
(neither On nor Off). I wonder if this is why placing a drush.ini file in ~/.drush/drush.ini didn't work, since it can only override variables that have already been specified, but not introduce new ones? Anyhow, here's the fix for my setup:The fix
cd /Applications/MAMP/bin/php/php5.3.20/conf
In case this file is useful for something, move instead of delete
sudo mv php.ini php.ini-original
Create symlink to the php.ini file that's actually being used
sudo ln -s /Library/Application\ Support/appsolute/MAMP\ PRO/conf/php.ini php.ini
As explained above, the following lines should should exist via the MAMP PRO edit template:
All is well! A drush.ini file is not being used in this approach, and here's the output from
drush status
Comment #56
greg.1.anderson CreditAttribution: greg.1.anderson commentedAre there any actionable changes to #54 in #55, or elsewhere? If not, #54 is still 'needs review'.
Comment #57
ShaunDychko CreditAttribution: ShaunDychko commentedHow about the attached patch which documents #55? MAMP PRO users will still be stuck after applying #54.
Notes:
I tried to get
export PHP_INI='/Library/Application\ Support/appsolute/MAMP\ PRO/conf/php.ini'
to work in~/.bashrc
since that seems more elegant, but couldn't make this work due to the spaces in the path. The commanddrush status
kept returning something likeCould not open input file: Support/appsolute/MAMP\
depending on which technique I tried using to escape the spaces.For testing #54, I added
magic_quote_gpc = On
through the php.ini MAMP PRO template editor, while having the attached drush.ini file in ~/.drush, anddrush status
reported the following:which means that drush.ini is not overriding the magic_quotes_gpc variable as expected.
Comment #58
greg.1.anderson CreditAttribution: greg.1.anderson commentedPer #36 and #37, -d does not seem to work for setting php.ini values on MAMP. If we are going to document MAMP changes in drush.ini, then we should say that drush.ini does not (always?) work on MAMP. I say "always?" because I believe some folks do use drush.ini on MAMP, but I am not sure.
Anyone have definitive answers regarding php.ini settings (esp. w/ -d) and MAMP?
Comment #59
xmacinfo@Shaun Dychko: Eventhough MAMP Pro uses it's own php.ini file, the Drush status command always mentionned which php.ini it is using:
You just need to apply the fix documented earlier in 31 in that PHP file.
It does not matter that Drush uses one php.ini file and that Drupal, through MAMP Pro, uses another PHP configuration.
Comment #60
ShaunDychko CreditAttribution: ShaunDychko commented@xmacinfo Thanks, and you're totally correct. I suppose the issue comes down to personal preference, and maybe we should just go ahead with #54, but there is still a niggling issue here for MAMP PRO users:
/Applications/MAMP/bin/php/php5.3.20/conf/php.ini
doesn't contain any PHP configuration options selected in the MAMP PRO UI or the Edit Template menu. The issue here is definitely with MAMP PRO, and not with Drush. The fix I mentioned in #55 allows making PHP changes in the MAMP PRO UI and the 'File -> Edit Template -> PHP -> PHP 5.3.20 php.ini' menu, for what it's worth. Maybe we should just say MAMP PRO tries too hard to be 'convenient' in this particular case, and let the comments in this issue queue suffice for anyone having similar difficulties?Comment #61
ShaunDychko CreditAttribution: ShaunDychko commentedIf MAMP PRO users could specify a custom php.ini file to Drush, that would go a long way toward solving this, and would take only one line of documentation to explain it. The problem is that the PHP_INI path in ~/.bashrc can't contain spaces, and I filed a separate issue for this here: https://drupal.org/node/2009840
Comment #62
JadH CreditAttribution: JadH commentedPatch #54 worked for me.
// Update
// -------------------
Patch #54 did not work.
The same error is showing again.
I am using XAMPP on my macbook Pro and I have Mamp Pro installed.
On the other hand, I am trying to figure out which php.ini the system is using to know if it is from Xampp or Mamp, but IT IS NOT showing in Terminal.
Comment #63
ShaunDychko CreditAttribution: ShaunDychko commented@JadH, are you running MAMP PRO? If so, which version?
Comment #64
C13L0 CreditAttribution: C13L0 commentedI apologize in advance if this is in the wrong issue. I am working on a shared GoDaddy server and am not able to edit the php.ini so a patch is my only option (I think). Drush works fine but the error is super annoying...would love to get rid of it. The drush.ini file is empty. Is there something that should be in there?
The following restricted PHP modes have non-empty values: [error]
magic_quotes_gpc. This configuration is incompatible with drush.
Please check your configuration settings in /web/conf/php5.ini or in
your drush.ini file; see examples/example.drush.ini for details.
PHP configuration : /web/conf/php5.ini
Drush version : 5.9
Drush configuration :
Comment #65
ShaunDychko CreditAttribution: ShaunDychko commentedTry the patch in comment #54
Comment #66
greg.1.anderson CreditAttribution: greg.1.anderson commentedYou also have to copy drush.ini to ~/.drush/drush.ini.
Comment #67
C13L0 CreditAttribution: C13L0 commentedThank you Shaun and Greg for super fast replies! I applied the patch, copied example.drush.ini to ~/.drush and renamed it drush.ini. I am probably doing something wrong but it still isn't working. If I am reading drush status correctly, drush.ini isn't over-riding php5.ini. I then copied the php5.ini file to /drush, changed +magic_quotes_gpc = Off. This also did not work. Have I tried everything possible or will it be best to wait for a new version of drush?
PHP configuration : /web/conf/php5.ini
/home/content/14/8477914/.drush/drush.ini
Drush version : 5.9
Comment #68
xmacinfo@C13L0: I am curious. Can you
add ini_set('magic_quotes_gpc', 'off');
in your settings.php file and report if Drush detects that setting?Comment #69
JadH CreditAttribution: JadH commentedFinally it worked, I am not getting the error anymore.
This is what I did:
Under .drush/ I have initially the drush.ini file.
I renamed it to php.ini file.
I just tried this based on the help in the drush.ini file.
; To fully specify the value of all php.ini variables,
; copy your webserver php.ini file to one of the
; locations mentioned above (e.g. /etc/drush/php.ini)
; and edit it to suit.
Comment #69.0
JadH CreditAttribution: JadH commentedUpdated based on comments in #31-40.
Comment #70
greg.1.anderson CreditAttribution: greg.1.anderson commentedI updated the summary for this issue. The problem is, some platforms seem to ignore -d and ini_set for magic_quotes_gpc. In these instances, php.ini must be used.
It would be great if we could figure out which platforms have this problem, so that we could document it. Failing that, I suppose we could change the documentation so that it says "if this does not work, edit php.ini."
Comment #71
C13L0 CreditAttribution: C13L0 commented@xmacinfo - I added to the settings.php file of one of the drupal sites (there are several sites on the same server, some are drupal and some aren't). There is no change
Comment #72
JadH CreditAttribution: JadH commentedHi All,
Even though I stopped getting the error with the magic_quotes, I am not being able to use drush.
I assume it is a bad environment installation on OSX 10.8.
I am using drush installed with Acquia, and now I don't know if I should uninstall everything and re-install and configure everything from scratch.
An example of some of the errors I am getting, maybe you can guide me if I should keep and it is a matter of some configurations or not.
Command make-generate needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command. [error]
The drush command 'generate-makefile template.make' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
N.B. If it is not related, please let me know so I remove this from the queue here.
Comment #73
greg.1.anderson CreditAttribution: greg.1.anderson commented#72: Please post in a separate issue. In this thread, we would like to determine under what circumstances -d and ini_set do not work to set magic_quotes_gpc.
Comment #74
geerlingguy CreditAttribution: geerlingguy commentedI figured out the problem on my computer (finally); for an earlier version of MAMP, I had copied out the MAMP php.ini and pasted it into
~/.drush/php.ini
, and it had the wrong path to the PHP binary inside (as well as some other old, stale values).I deleted the new drush.ini file I had added, and also updated the php.ini file inside .drush with the latest (5.3.20) php.ini from MAMP, and now I don't get the warning anymore.
Comment #75
C13L0 CreditAttribution: C13L0 commentedSince this is a fact finding mission, I wanted to note this is a GoDaddy shared server which is CentOS release 5.5 (Final)
Comment #76
serialbob CreditAttribution: serialbob commented#51 work for me, i think it's php version or server dependant.
In my case Debian 5 / php 5.2.x
Thanks
Comment #77
dddbbb CreditAttribution: dddbbb commented#51 worked for me (MAMP Pro).
Comment #78
Michael-IDA CreditAttribution: Michael-IDA commented#73 Hi Greg,
From http://php.net/manual/en/security.magicquotes.disabling.php
Best,
Sam
Comment #79
Michael-IDA CreditAttribution: Michael-IDA commentedHi Greg, et. all,
Question / Footnote on the whole Magic Quotes:
I have multiple machines / hosting accounts running PHP 5.3.x, which have "magic_quotes_gpc => On" but "magic_quotes_runtime => Off" , using Drush versions < 5.8. [one is pasted below]
I just purchased a new VPS w/ 6 Cores, 24 Gigs RAM, 24 Gigs Swap, etc., blah. to move/consolidate clients too. It has the exact same Magic Quotes setup.
Drupal 5, 6, and 7 have never had a problem with Magic Quotes. Drush 5.7 (and lessor) never reported an error. Drush 5.9 now spits that error, which I have to question, “Is it truly an error?”
And, as an old business programmer, I'd rather not break working D5, D6, and D7 sites to add an error message or error check for an item that showed no destructive behavior. Alternatively you could say, “Even if it is a bug, it's been working correctly for the last 5 to 10 years.”
Especially since Magic Quotes will be removed entirely as of PHP 5.4.
Unfortunately, I don't really have a constructive suggestion. Just the question, “Can't we just leave it alone to die a natural death?” [, and spend our time working on something more productive?]
Best Regards,
Sam
From http://www.php.net/manual/en/security.magicquotes.what.php
Comment #80
greg.1.anderson CreditAttribution: greg.1.anderson commentedThe intention here was to attempt to automatically disable magic_quotes_* in Drush via -d options to php (per #78, the idea to use ini_set cannot work by design). As far as I know, this is only to benefit D8; I don't think that D6 or D7 have a problem with magic_quotes_*. The open issue we still have here is that some systems (usually MAMP?) do not allow -d to affect the magic_quotes_* values.
It also seems that some mistakes were made here. #35 was never committed. (To be fair, I am not sure if this is because it was unnecessary, or if it was just missed, but I suspect the later.) #47 seems to not fix the problem, as it accidentally removes the key portion of the new behavior:
Adding magic_quotes_* to php_option is the main thing we were trying to accomplish here, so that should not have been removed.
Regarding #79, I don't know how much value there is to adding magic_quotes_* to our ini checks. Doing this might help some MAMP folks for whom the -d fix does not work, iff they are using D8, as without it, Drupal might fail later if their config is wrong, and this might be hard to diagnose. For all others, it adds a spurious error.
I will make a patch that re-applies the code that shouldn't have been removed in #47, but it uses 'Off' instead of '0', like 35, and remove the magic_quotes_* items from our ini checks during bootstrap.
Comment #81
greg.1.anderson CreditAttribution: greg.1.anderson commentedHere is the aforementioned patch. It looks like #47 actually switched from -d to ini_set, which does not work. Sorry about that.
Comment #82
byronveale CreditAttribution: byronveale commentedFor what it's worth...
I was getting this error using drush 5.9 with the Acquia dev desktop 7.22.23 (Drupal 7.22) on Mac OS X 10.8.4:
Copied drush/example.drush.ini into ~/.drush/drush.ini, and copied this into that file:
No more error message!
Probably don't need that last line...
Hope this helps someone else getting this error message; I got tired of seeing it every time I typed a drush command!
Comment #83
Michael-IDA CreditAttribution: Michael-IDA commentedHi Greg,
> “As far as I know, this is only to benefit D8”
I use Drush everyday (okay, that might be stretching it a little) on numerous hosts, having to patch every Drush install above 5.8/5.9 is problematic. [In truth, I've just regressed to 5.7. Time benefit analysis and such.]
I hit the error message with Recommended releases, Drush version 7.x-5.9, which does not support Drupal 8 (well per the Drush project page). Drush 6.x will support Drupal 8.
Can we then remove this from the Drush 5.x series? And, leave whatever Drupal 8 needs in the Drush 6.x series?
Best,
Sam
[Lord help me, I've probably typo'd a Drupal for a Drush somewhere]
Comment #84
greg.1.anderson CreditAttribution: greg.1.anderson commentedI think #81 will address your issues; it can be backported to Drush-5 after it is committed to Drush 6. I don't know why the magic-quotes stuff was backported to Drush 5; maybe I'm wrong about this only being for D8. I didn't do the research to see when it was actually introduced.
Comment #85
moshe weitzman CreditAttribution: moshe weitzman commentedCommitted to 6. Should we also now remove the mention of these ini settings from README.txt? I left it since it sounds like some platforms don't honor -d
Comment #86
greg.1.anderson CreditAttribution: greg.1.anderson commentedI think that the README.txt instructions are necessary to help folks who are on a platform where -d does not work.
Should this be backported to Drush 5?
Comment #87
greg.1.anderson CreditAttribution: greg.1.anderson commentedHere is a backport to 7.x-5.x.
Comment #88
greg.1.anderson CreditAttribution: greg.1.anderson commentedSetting version.
Comment #89
jonhattanTested and committed to 5.x
Comment #90.0
(not verified) CreditAttribution: commentedSome platforms do not respect -d or ini_set for magic_quotes_gpc.
Comment #91
josericardo CreditAttribution: josericardo commentedthe better solution thanks GOD
http://drupal.stackexchange.com/questions/57556/drush-installation-probl...