Make WordPress Core

Opened 15 years ago

Closed 6 years ago

#11282 closed defect (bug) (maybelater)

Bizarre Behavior When wp-content Missing

Reported by: miqrogroove's profile miqrogroove Owned by: westi's profile westi
Milestone: Priority: normal
Severity: normal Version: 2.8.4
Component: Themes Keywords:
Focuses: Cc:

Description

Steps to reproduce:

  1. Begin and complete a normal installation, but skip or remove the wp-content directory.
  1. Try to view the Dashboard and the Visit Site link.

Expected Result: WP did not install, wp-content is missing.

Actual Result: Dashboard is visible, site's front page is not. In /wp-admin/error_log

PHP Warning: array_keys() [<a href='function.array-keys'>function.array-keys</a>]: The first argument should be an array in /wp-includes/theme.php on line 481

Attachments (2)

11282.diff (4.4 KB) - added by westi 15 years ago.
A first pass patch ugly and wide ranging
11282-check-content-dir-at-setup.diff (715 bytes) - added by ifrins 13 years ago.

Download all attachments as: .zip

Change History (37)

#1 @dd32
15 years ago

I'm not too sure of the need for this..

Then again, a simple addition could "fix" it:

if ( ! is_dir(WP_CONTENT_DIR) )
   wp_die( sprintf('Your wp-content directory(%s) is missing.', WP_CONTENT_DIR) );

It comes down to performance perhaps, Is an extra IO check needed when this would only occur under a incorrect/incomplete install?

It could alternativly only be added to the installer.. rather than wp-settings.php

#2 @scribu
15 years ago

  • Milestone changed from 2.9 to Future Release

+1 on adding it to the installer and not wp-settings.php

Moving to Future Release until a patch is available.

#3 in reply to: ↑ description @lloydbudd
15 years ago

miqrogroove, it might help if you describe how you encountered this issue?

NOTE: if done for run-time, any check should likely only be done on the wp-admin side, we've had issues previously when we used to check for theme, see Ticket #3907 "WP reverts to default theme on file access collision"

#4 follow-up: @miqrogroove
15 years ago

lloydbudd, I forgot to upload the wp-content folder before running the install script. That's not really the point though. The arguments to array_keys aren't handled correctly.

dd32, the IO check only needs to happen when the theme list is empty (but preferably also during install). It should be trivial to do is_dir() right before array_keys() craps out.

#5 @miqrogroove
15 years ago

p.s. Wouldn't there be other obvious checkpoints, like when no template is found for the front page?

#6 in reply to: ↑ 4 @lloydbudd
15 years ago

Replying to miqrogroove:

lloydbudd, I forgot to upload the wp-content folder before running the install script. That's not really the point though.

The likelihood of others encountering an issue is always relevant.

#7 @miqrogroove
15 years ago

I didn't want to focus on the scenario. Imagine if a folder was accidentally deleted or renamed on a production site, and all of a sudden the front page just goes blank. Or what if it's just the style.css file?

#8 follow-up: @miqrogroove
15 years ago

  • Milestone changed from Future Release to 3.0

I also confirmed in 2.9.2 the front end throws a WSOD with no errors reported when the theme is missing for any reason. This needs consideration in 3.0.

#9 @dd32
15 years ago

  • Milestone changed from 3.0 to Future Release

No traction in recent times. No patch. Moving to Future Release.

#10 in reply to: ↑ 8 @westi
15 years ago

Replying to miqrogroove:

I also confirmed in 2.9.2 the front end throws a WSOD with no errors reported when the theme is missing for any reason. This needs consideration in 3.0.

This has been there for a while ever since we removed the validate_current_theme check on the frontend due to it not being reliable on some servers to do this.

As recently discussed on wp-hackers I think a better error page is needed here and I will add this soon.

@westi
15 years ago

A first pass patch ugly and wide ranging

#11 @westi
15 years ago

  • Keywords has-patch added
  • Status changed from new to accepted

That is a first pass - error is ugly for now and I had to touch a lot of code to get it working.

Untested in multisite mode at present.

#12 @miqrogroove
15 years ago

Hi westi (and dd32), I noticed your patch says @since 3.0.0. Do we need to reset the milestone for this ticket?

#13 @nacin
15 years ago

  • Milestone changed from Future Release to 3.0

westi has indicated he wants to do this soon, so future -> 3.0.

#14 @westi
15 years ago

Yeah. Musing on getting this right.

The patch has since 3.0.0 in it as I wrote it for now.

Need to unuglify and test for multisite first.

#15 @westi
15 years ago

  • Component changed from Warnings/Notices to Themes
  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 3.0 to 3.1

I'm still in the camp for a better error page but I would like to leave this till 3.1 as it is not a major issue and doesn't occur frequently.

I want to see if we can maybe find a good solution to this - maybe we can come up with a way of using the default theme but displaying an error in the backend when we can't find the theme files.

#16 @nacin
14 years ago

  • Milestone changed from Awaiting Triage to Future Release

#17 @ifrins
13 years ago

  • Cc ifrins added

Added a patch to check if the wp-content directory exists before starting the installation in wp-admin/setup-config.php

#18 @ifrins
13 years ago

  • Keywords has-patch added; needs-patch removed

#19 @thee17
13 years ago

As of 3.4 there is an error on the dashboard "ERROR: The themes directory is either empty or doesn’t exist. Please check your installation."

The plugins page looks like you have no plugins with no warning.

The themes page looks funny but no warning.

Media when uploaded creates a wp-contents/uploads folder.

If you try to install a theme or plugin you get an "ask for credentials" screen.

#20 @thee17
13 years ago

  • Cc charles@… added

#21 @MikeHansenMe
12 years ago

  • Keywords close added

I agree with thee17. The red error message in the dashboard seems sufficient. Proposing we close the ticket.

#22 @scribu
12 years ago

  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from accepted to closed

#23 @miqrogroove
12 years ago

#21931 was marked as a duplicate.

#24 @miqrogroove
12 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

More discussion is needed before closing this ticket.

#25 @scribu
12 years ago

Don't just reopen a ticket with a blanket statement like that. Bring some new information to the table.

#26 @MikeHansenMe
12 years ago

After looking into the issue again, I still think the red error message is noticeable. The only situation I could still see a problem is if the user has turned off the "Right Now" from their Dashboard.

#27 @bpetty
12 years ago

  • Keywords close removed
  • Milestone set to Awaiting Review

So, it seems like this ticket needs to either decide if it's about improved warnings/notices in admin, or if added notices and possible fix during install is sufficient.

For better warnings/notices just for the case of themes, see #21931.

#28 @bpetty
12 years ago

  • Cc bpetty added

#29 @miqrogroove
12 years ago

They are the same bug, that's why I marked #21931 as a duplicate of this older one. You can't just fix it in the installer and then let the site W.S.O.D. at some other time without informing the admin that the site is broken. I wasn't being selective about which aspects need to be fixed.

#30 @bpetty
12 years ago

The OP describes problems very specific to the installation process here while #21931 is specific to the lack of notifications (yes, about the same problem mostly) in the admin after WordPress has been installed.

They are similar tickets, but really do identify two different issues in two different workflows that will likely require two different patches (or maybe the second patch utilizing code in the first - but still two patches).

I'm not saying one should be fixed without the other, just keeping the tickets separated since they are two different problems.

#31 @miqrogroove
12 years ago

Actually I don't think #21931 is about lack of notifications in the admin. That would be a third bug if you are trying to keep them separate.

This ticket was mentioned in IRC in #wordpress-dev by tierra. View the logs.


11 years ago

#33 @nacin
11 years ago

#26143 was marked as a duplicate.

#34 @chriscct7
9 years ago

  • Keywords needs-refresh added

#35 @danielbachhuber
6 years ago

  • Keywords has-patch needs-refresh removed
  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from reopened to closed

Here's a screenshot of the current frontend behavior when the wp-content directory is missing:

https://user-images.githubusercontent.com/36432/55637751-9d685d80-577a-11e9-8945-9dd246485362.png

More specifically, a "ERROR: The themes directory is either empty or doesn’t exist. Please check your installation." message is disabled.

This behavior seems sufficient to me. Given the age of the ticket, it doesn't seem like this is a necessary problem to solve.

Note: See TracTickets for help on using tickets.