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.
The issue observed on Windows, IIS 10, and PHP 7.
The latest version of PHP, 7.0.19, fixes this bug in PHP and defines the constant DATE_RFC7231 in PHP itself.
As a result, Bootstrap now generates a notice:
Constant DATE_RFC7231 already defined in C:\vhosts\my-site\includes\bootstrap.inc on line 258
In my environment, a PHP notice at that stage of Bootstrap completely broke the site. I could revert the PHP version to the previous one, but there was no workaround in user interface.
Comment | File | Size | Author |
---|---|---|---|
#26 | DATE_RFC7231-2877243-26.patch | 710 bytes | David_Rothstein |
Comments
Comment #2
karoop CreditAttribution: karoop commentedComment #3
karoop CreditAttribution: karoop commentedComment #4
cilefen CreditAttribution: cilefen commentedIn what way does this qualify as critical priority?
Comment #5
karoop CreditAttribution: karoop commentedIt rendered my site completely unusable with no immediate workaround except for applying the patch. Feel free to change the priority if you find a workaround.
Comment #6
cilefen CreditAttribution: cilefen commentedYou wrote that it's a notice. I did not infer "site is unusable" from that.
Comment #7
karoop CreditAttribution: karoop commentedComment #8
travis uribe CreditAttribution: travis uribe commentedThis exact issue causes a fatal error, not a notice, in our project.
Comment #9
cilefen CreditAttribution: cilefen commentedComment #10
cilefen CreditAttribution: cilefen commentedComment #11
Crell CreditAttribution: Crell at Platform.sh commentedThis seems like a straightforward enough quick fix, regardless of the priority level. Strictly speaking we could make it a const, instead of a define(), but the difference is marginal so... RTBC.
Comment #12
MegaChriz CreditAttribution: MegaChriz as a volunteer commented@Crell
We cannot make it a
const
as that syntax (outside of class context) is only supported since PHP 5.3.0 (see http://php.net/manual/en/language.constants.syntax.php) and Drupal 7 officially still supports PHP 5.2.5+ (see https://www.drupal.org/docs/7/system-requirements/php#php_required).Comment #13
Crell CreditAttribution: Crell at Platform.sh commentedAh, you're right, I didn't notice the version was set to 7. Still RTBC.
Comment #14
deminyFor PHP 7.1, same issue doesn't happen on PHP 7.1.4 but does happen on PHP 7.1.5 (which was released on 5/11, the day before yesterday). The patch file included in #2 does fix the issue for PHP 7.1 as well.
Comment #15
robertgarrigos CreditAttribution: robertgarrigos as a volunteer commentedpath in #2 fixed it for me also (php 7.1.5)
Comment #16
nateB CreditAttribution: nateB as a volunteer commented#2 works for me on PHP 7.1.5 and mysql 5.7.18
Comment #17
egontinno CreditAttribution: egontinno commentedPatch #2 fixed my site too (PHP 7.0.19). It was completely down, so it's critical fix for PHP7 users.
Comment #18
karoop CreditAttribution: karoop commentedComment #19
jief CreditAttribution: jief commented#2 works on 7.0.19
Comment #20
heddnFixed my D7 site too. +1 on RTBC.
Comment #21
gregglesAnother +1.
Comment #22
Anonymous (not verified) CreditAttribution: Anonymous commentedIs there any short term fix I can do in the meantime to get rid of the warning for a D7 site?
Comment #23
joseph.olstad@failcookie , what warning are you speaking of? Does this occur after having applied the patch from comment number 2?
Comment #24
Anonymous (not verified) CreditAttribution: Anonymous commentedSorry! I totally missed that patch for some reason - Yes, the patch fixed the issue for me. Thank you for your help, @joseph.olstad.
Comment #25
joseph.olstadComment #26
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedThe patch looks good, but let's add a code comment which explains why we need to do this. See attached for a possibility.
I am confused how this could cause a fatal error on anyone's site (since it's just a PHP notice).... It certainly didn't for me. However, it occurs early enough in the bootstrap that the notice won't get picked up by Drupal's error handler, which means it might be displayed on the screen to end users regardless of the site configuration, plus (for some reason I don't understand) a notice this early also interrupts the installer and prevents it from running... so critical priority seems correct.
This can go into the next regular bugfix release (rather than specifically waiting for Drupal 7.60).
I checked Drupal 8 and it uses
Drupal\Component\Datetime\DateTimePlus::RFC7231
instead, so it shouldn't have a similar issue.Comment #27
joseph.olstadThe added comments are helpful easy to understand.
Thanks :)
Comment #28
pacproduct CreditAttribution: pacproduct commentedPatch #26 applies OK on Drupal 7.54 and fixes the issue.
Cheers!
Comment #29
pmchristensen CreditAttribution: pmchristensen commentedAlso checked and tested patch #26 - working like a charm! Should be ported - nice job!
Comment #30
oxrc CreditAttribution: oxrc as a volunteer commentedThis occured to me on Windows with apache 2.4 and PHP 7.1.5, although the notices were supposed to be hidden by my PHP settings. The patch #26 fixed it.
Comment #31
bmateus CreditAttribution: bmateus commented#26 worked for me - thanks!
Comment #32
joseph.olstadI just triggered two retests for php 7 and php 7.1.
something changed with the testbot php 7 config since Feb 1 2017 when head passed?
Here is the Feb 1 2017 - head test for D7 with php 7
Perhaps the simpletest configuration had it's php 7 version(s) (7 and 7.1) changed?
haven't yet looked closely at the test results, just making an observation for now
Comment #33
delta CreditAttribution: delta commentedReproduced with PHP 7.1.5
Applying #26 fixed it.
Thanks
edit: this is a fairly simple fix (I can't think of any regression implied by it), therefore it would be (very) nice to have it in the next bugfix release, than waiting for 7.60
Comment #34
pjcdawkins CreditAttribution: pjcdawkins at Platform.sh commentedDrupal core should never have declared a constant without a Drupal namespace. Users are going to hit this bug whenever they update PHP to the latest stable version(s), and it will break their sites.
So, I agree, this really should be included in the next release of core, whatever that may be.
Comment #35
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedHa, maybe not, but there are like 200+ examples of that in Drupal 7 core, and 100+ in Drupal 8 core already :)
Hm, I'll rerun the HEAD tests also to see if those fail on PHP 7 too. (The failures in the patch test are date-related, so it's at least possible it has something to do with this patch. On the other hand, the testbot seems to be running PHP 7.0.18 currently.)
Comment #36
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedIt turns out the PHP 7 test failure is in HEAD too (https://www.drupal.org/pift-ci-job/676235) so I guess that's a separate regression due to some other post-release change in PHP 7 and probably needs a separate issue to look into.... Any of the people active in this issue would be welcome to help with that since you're already running PHP 7 :)
The patch here is therefore probably ready to commit.
Comment #37
geerlingguy CreditAttribution: geerlingguy at Midwestern Mac, LLC commentedAnother +1 RTBC from me. New server is outputting the notice at the top of every rendered page; glad I caught this before upgrading my prod server!
Comment #38
Ollie222 CreditAttribution: Ollie222 commentedI've just come across this issue on my new dev server running php 7.1.5 and the patch in #26 looks to solve the problem for me, thanks for the fix.
In my case as well as posting the warning when viewing general pages it also breaks things like module update admin interface.
Comment #39
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedTurns out that was already fixed in Drupal 8 but never backported to Drupal 7. I made an issue and patch to backport it now: #2880700: [D7] UserTimeZoneFunctionalTest fails on recent versions of PHP 7 and 7.1
Comment #40
vegardjo CreditAttribution: vegardjo commented#26 works fine for me as well!
Comment #41
GiorgosK#26 is good please commit
Comment #42
randell CreditAttribution: randell commented#26 works for me on Drupal 7.54 and PHP 7.0.19.
Comment #43
PolHi,
I don't think D7 is still being taken care of... sadly, so, better add this patch to your makefiles ;-)
Comment #44
joseph.olstad@pol, better yet, lets fork D7 and let's take this off of drupal.org, make a new update module that pulls from Github instead.
Comment #45
PolI don't think this is a good idea... even if I would prefer to work on Github :-)
"Forking" Drupal 7 would makes things even more messier.
I just hope one day some people will just take care of D7 for the millions of sites yet running it.
The best frustrating example is: #1545964: Do not copy over the owner and engine of a theme if the child theme uses a different engine than the base theme
Comment #46
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commentedCan anyone confirm whether there will be a release of Drupal 7 in the bugfix release window next week, and whether this patch will be part of that release? Since this blocks upgrades to php 7.0.19 and 7.1.5, it would be helpful if this could go out then.
Are there any other issues that might block a Drupal 7 release next week?
Comment #47
nickonom CreditAttribution: nickonom commentedI also confirm #26 works.
Comment #48
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedYes, this should go out in the next monthly release window (i.e. next week). I'm planning to do some commits tomorrow.
Comment #49
GuillaumeDuveauGreat :)
#26 is OK for me too.
Comment #50
legovaerAlso I can confirm that the patch in #26 is working fine!
Comment #51
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commented++Dave_Rothstein Thanks so much.
Comment #53
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedCommitted to 7.x - thanks! This will go out in the next monthly release window (scheduled for June 7).
@Pol/others: Most people listed in the Drupal 7 MAINTAINERS.txt file are no longer active. However there are 3 core committers who are active. I've been involved in this issue, and others have been involved in other issues (including the one you linked to, which I just reviewed now also and which is not ready to commit for a number of reasons, including the fact that it appears to still need fixing in Drupal 8 which was discussed a few times in that issue's history).
As far as I know, we're all essentially doing this in our free time, and I haven't heard of any organizations or website owners who are interested in sponsoring Drupal 7 maintenance work. So, thanks for your patience - and your contributions :)
Comment #55
waqarit CreditAttribution: waqarit commented#26 works for me. (Drupal 7.54, php 7.0)
Comment #56
donapis CreditAttribution: donapis commented#26 works for me. (Drupal 7.56, php 7.1.5)
Comment #57
timhtheos#2 patch works for me in PHP 7.0.20. Thnx.
Comment #58
willhallonline+1 for 7.54 with PHP 7.1.7
+1 for 7.56 with PHP 7.1.7
Comment #59
noi_ag CreditAttribution: noi_ag commented#26 worked for me
Drupal 7.54 PHP 7.1.11
thanks!
Comment #60
shilpadru8187 CreditAttribution: shilpadru8187 commented@David_Rothstein #26
Worked for me on PHP 7.1.11
Thanks
Comment #61
rooby CreditAttribution: rooby commentedUn-hiding the patch
Comment #62
joseph.olstadFYI: this was committed prior to the 7.55 release so the fix is already in 7.55 and 7.56.
Comment #63
Justincletus CreditAttribution: Justincletus commentedKaroop, #2 is fix this error on php v7.0 also..
thanks
Comment #64
kennybell CreditAttribution: kennybell commented#2 Solved the issue for me.
Comment #65
klonos...
You guys do know that this has already happened, right?:
https://backdropcms.org
...it is a great idea!: https://github.com/backdrop/backdrop ...hell yeah, GitHub makes things sooo much easier.
...nope, it makes things sooo much less messier ...the specific fork was made and is well-maintained by people that absolutely love Drupal 7.
shameless plug: Yep, we've got things started some 4+ years ago. Come join us!! :)
Comment #66
joseph.olstadbackdrop cms, great project, unfortunately everything my clients need is in the stuff that was dropped. Like multilingual , entity_translation, i18n, entity_translation_unified_form , stuff that larger international organizations need.
so ya, Drupal still paying the bills. However yes I'll keep peeking at backdrop , quicksketch has done some excellent work there! Drupal 7 gets it done.
Comment #67
klonos...well technically @joseph.olstad the multilingual/translation stuff was not "dropped"; they just have not been ported/implemented yet :) Backdrop is not D8 -things; it is D7 +someD7contrib +someD8 +magic +love :)
Comment #68
oadaeh CreditAttribution: oadaeh at Hook 42 commentedUpdating Issue tags so this issue shows up with the rest of the PHP 7 issues.
Comment #69
sushilkr CreditAttribution: sushilkr commented#26 Work for me
I was getting same error issue add only
if (!defined('DATE_RFC7231')) {
define('DATE_RFC7231', 'D, d M Y H:i:s \G\M\T');
}
Instead of define('DATE_RFC7231', 'D, d M Y H:i:s \G\M\T'); @ line no 258 in bootstrap.inc
Thanks!!
Comment #70
joseph.olstadThis was released in 7.55
so 7.67 (current release) has this fix,
if you're still needing this patch it's because you're using php 7 with some version of core prior to 7.55?
Comment #71
AswathyAjish CreditAttribution: AswathyAjish commentedThanks. Patch in #26 worked for me.