Deprecation warning on every phabricator page

I have updated our phabricator instance to latest git stable earlier today. We now see a “Deprecated:” warning on the top of every phabricator page:

Deprecated : Function get_magic_quotes_gpc() is deprecated in /app/phabricator/support/startup/PhabricatorStartup.php on line 526

Logging in with password authentication with a clean browser window (firefox private window) is no longer possible:
Deprecated: Function get_magic_quotes_gpc() is deprecated in /app/phabricator/support/startup/PhabricatorStartup.php on line 526
Auth Unhandled Exception (“AphrontMalformedRequestException”)
Unhandled Exception (“AphrontMalformedRequestException”)
You are trying to save some data to Phabricator, but the request your browser made included an incorrect token. Reload the page and try again. You may need to clear your cookies. This was a Web request. This request had an invalid CSRF token.

Phabricator/Arcanist Version
*Output from Config > Version Information

c4b4a53cad7722f031b725f8b41511e9d341d033 (Fri, Dec 13) (branched from 54bcbdaba94a3573e128c6498816dbfa41d3a9cb on origin)
bac2028421a4be6e34e08764bbbda49e68b3a604 (Tue, Nov 19) (branched from cc850163f30c4697e925df0d6212469679600a2c on origin)
1750586fdc50a6cd98adba4aa2f5a7649bd91dbe (Sep 30 2019) (branched from 39ed96cd818aae761ec92613a9ba0800824d0ab0 on origin)
3.7 at /usr/bin/diff
2.20.1 at /usr/bin/git
Not Available
2.3.1 at /usr/bin/pygmentize
Not Available

Steps to reproduce:

Update phabricator to latest git stable, then open any page on that phabricator. Observe the top line starts with “Deprecated:”.

I found that the only purpose of calling get_magic_quotes_gpc() is to warn the user if they are enabled. I deleted the code that checks for this and with this change our phabricator works again.

Maybe you could introduce a try/catch around your call to get_magic_quotes_gpc() to prepare for php 7.4 which apparently raises an exception.

I filed this upstream as

Since I don’t have a version of PHP which raises this warning handy, it would be helpful if you could confirm that this patch fixes the issue:

diff --git a/support/startup/PhabricatorStartup.php b/support/startup/PhabricatorStartup.php
index 4c577ca20c..c166162310 100644
--- a/support/startup/PhabricatorStartup.php
+++ b/support/startup/PhabricatorStartup.php
@@ -523,7 +523,7 @@ final class PhabricatorStartup {
-    if (get_magic_quotes_gpc()) {
+    if (@get_magic_quotes_gpc()) {
         "Your server is configured with PHP 'magic_quotes_gpc' enabled. This ".
         "feature is 'highly discouraged' by PHP's developers and you must ".

That is, add a single @ character before the call.

Don’t worry about it if that’s a pain to test, but it could save me some time juggling PHP versions to confirm the fix.

1 Like

Thanks, I have tried your solution with the additional @ on our installation and can confirm that it fixes the issue.

This should now be fixed upstream by