WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#7738 closed defect (bug) (worksforme)

undefined functions on trunk install attempt

Reported by: DD32 Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

Fatal error: Call to undefined function is_admin() in /wp-admin/includes/comment.php on line 124

The floated avatar on admin screens runs on all admin pageloads, which includes the isntall, problem is, not all the code is loaded for installs. See patch.

Attachments (1)

7738.diff (959 bytes) - added by DD32 10 years ago.

Download all attachments as: .zip

Change History (9)

@DD32
10 years ago

#1 @DD32
10 years ago

oops, Should've actually tested said patch before submitting. add_action() isnt available at that point either.

#2 @DD32
10 years ago

  • Summary changed from Fatal error: Call to undefined function is_admin() upon install to undefined functions on trunk install attempt

__() is also used within file.php in the global scope, Loading all the code for the install might be a better option? allthough could be over the top or may cause some extra warning-level notices due to undefined variables/constants.. I've not tested that.

The change for this would be :

Index: wp-admin/includes/upgrade.php
===================================================================
--- wp-admin/includes/upgrade.php	(revision 8875)
+++ wp-admin/includes/upgrade.php	(working copy)
@@ -2,6 +2,7 @@
 
 if ( file_exists(WP_CONTENT_DIR . '/install.php') )
 	require (WP_CONTENT_DIR . '/install.php');
+require_once(ABSPATH . 'wp-settings.php');
 require_once(ABSPATH . 'wp-admin/includes/admin.php');
 require_once(ABSPATH . 'wp-admin/includes/schema.php');

#3 @ryan
10 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [8881]) Hook floated_admin_avatar to admin_init. Props DD32. fixes #7738

#4 @ryan
10 years ago

(In [8882]) Revert [8881], patch wasn't ready. see #7738

#5 @ryan
10 years ago

I have problems with reading comprehension sometime. :-)

Maybe we should just include wp-load.php and be done with it.

#6 @ryan
10 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#7 @DD32
10 years ago

Maybe we should just include wp-load.php and be done with it.

wp-load is included, But it relies on wp-config.php to load wp-settings.php to load everything.. at that point there is no wp-config.php!

So thats the explanation for the patch thats inline with this ticket in comment 2.

#8 @DD32
10 years ago

  • Milestone 2.7 deleted
  • Resolution set to worksforme
  • Status changed from reopened to closed

I cant duplicate the issue now.. I'm not sure what changed (Well, for a start, require_once(ABSPATH . 'wp-admin/includes/admin.php'); is no longer included in wp-admin/includes/upgrade.php - but cant seem to find when that was removed), but it works now.

Note: See TracTickets for help on using tickets.