Make WordPress Core

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#4997 closed defect (bug) (fixed)

Install wp_die() undefined

Reported by: maximeh's profile maximeh Owned by:
Milestone: 2.3 Priority: normal
Severity: major Version: 2.3
Component: Administration Keywords: wp_die missing function has-patch
Focuses: Cc:

Description

Hi,

Just made a fresh install from a svn checkout (to do some bug chasing). And after configuration was welcomed by a blank page. Searched a bit and found an error in my apache log :
PHP Fatal error : Call to undefined function wp_die() in ../wp-includes/wp-db.php on line 404, referer : [...]/wp-admin/setup-config.php?step=1

It think it was the select($db) that caused this issue (line 93). Can't found the wp_die() function anywhere in this file.

Attachments (2)

4997.diff (1.9 KB) - added by DD32 17 years ago.
4997.2.diff (4.2 KB) - added by DD32 17 years ago.

Download all attachments as: .zip

Change History (18)

#1 @maximeh
17 years ago

I just digg in a little bit more and I was thinking that just a little include for functions.php at the top of wp-db.php should be fine. What do you think ?

#2 @DD32
17 years ago

I'll have a dig into the code, that line was recently changed to use wp_die(). i'll see if i can spot it.

#3 @maximeh
17 years ago

Including functions.php works but the header are sent twice. Will look at this (in functions.php at 1246)

#4 @DD32
17 years ago

I was thinking that just a little include for functions.php at the top of wp-db.php should be fine. What do you think ?

The issue is that setup-config.php doesnt include the functions file, I'm just writing in a few changes now.

The Wordpress logo is shown twice with this patch if the database doesnt exist though.

@DD32
17 years ago

#5 @maximeh
17 years ago

Yes because functions.php (more precisly wp_die()) sent some headers but they are already sent by setup-config.php.

I don't know how to manage that. maybe wp_die can detect his referer and don't sent his header if it's setup-config. It seems big for a small issue like this one.

#6 @DD32
17 years ago

sent some headers but they are already sent by setup-config.php.

I added a check to wp_die() to check if headers had allready been sent before sending any in patch 4997.diff

@DD32
17 years ago

#7 @maximeh
17 years ago

Yes saw it after I push the submit button, sorry.

In setup-config.php, there is some html code for every pages in the install process and they are always including. Even in the error page. Appears that's why they are double logo.
A good if sentence around this html should solve this, what do you think ?

#8 @DD32
17 years ago

4997.2.diff

Included compat.php in case a setup function needs it (require removed from functions.php back in [6108])

make setup-config.php include the functions.php file for wp_die() required by wp-db.php

changed the setup-config.php die()'s to use wp_die() instead(Looks a bit more pretty than a plain text output)

Added a function wrapper around the header HTML for install steps 0 and 1, Step 2 only displays the header if no errors occur (ie. after wp-db.php would've called wp_die() for an error).

What do people think?

#9 @maximeh
17 years ago

Works for me but for step 2, I've got nothing but a blank page. If I move the display_header() to the top of the case, I've got the headers of the file but no more. (Only if there's an error in the values)

Don't actually know why.

#10 @DD32
17 years ago

  • Keywords has-patch added
  • Severity changed from normal to major
  • Version changed from 2.2.3 to 2.3

Don't actually know why.

Neither do i, I've done the install a few times over now and varying the conditions and not had a problem.
You havnt made another code change somewhere which is interfering have you?

(back in 10 hours; hopefully you'll have resolved/found the problem by then)

#11 @maximeh
17 years ago

Nop, I've just added your second patch, i was writing the same but you were the quickest ;).

Will look for this just after I went home !

#12 @santosj
17 years ago

Have you tried deleting the whitespace after the closing ?> in the files preseding the ones before?

#13 @maximeh
17 years ago

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

Works for me, some dirty includes that was in a file during an other test, my bad.

#14 @foolswisdom
17 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

maximeh, please don't close bugs as fixed, leave that for commiters.

#15 @ryan
17 years ago

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

(In [6137]) Fix includes for setup-config so that wp_die is defined. Props DD32. fixes #4997

#16 @maximeh
17 years ago

foolswisdom : sorry about that.

Note: See TracTickets for help on using tickets.