craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.28k stars 635 forks source link

Blank screen after updating phpdotenv to 5.4.0 in a 3.7.34 install #10645

Closed jeromecoupe closed 2 years ago

jeromecoupe commented 2 years ago

Description

Upgraded Craft to 3.7.34 and upgraded plugins (Feedme 4.4.1.1 and Redactor 2.10.4). Everything was fine. Then proceeded to upgrade phpdotenv from 3.4.0 to 5.4.0 All upgrades were done via composer

Blank page after that on the front-end and CP. Reverted phpdotenv to 3.4.0 and back to normal

My questions are:

Steps to reproduce

  1. Upgrade craft install and leave phpdotenv to 3.4.0
  2. Blank pages
  3. Copy web/index.php and boostrap.php and everything seems ok

Additional info

angrybrad commented 2 years ago

phpdotenv 5.x initializes itself differently than how 3.x did.

Here's the 5.x syntax Craft uses in the shared bootstrap: https://github.com/craftcms/craft/blob/main/bootstrap.php#L13-L16

Older versions of https://github.com/craftcms/craft had phpdotenv loading in both public index.phd the craft executable.

Recent ones have moved to the shared bootstrap model so it only has to be maintained in one place.

Regardless, sounds like if you copy the public index.php, craft executable and the shared bootstrap, you'll be good to go.

jeromecoupe commented 2 years ago

Blimey that was fast! Sounds clear enough. Thanks for chiming in @angrybrad

My main goal was to make sure I understood what was going on and that I was not missing anything in terms of what I should pay attention to. All good.