WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#14026 closed defect (bug) (fixed)

Export errors

Reported by: dimitre Owned by:
Milestone: 3.0.1 Priority: highest omg bbq
Severity: blocker Version: 3.0
Component: Export Keywords:
Focuses: Cc:

Description

Export doesn't work in 3.0 in my server.
First errors are:

Warning: strip_tags() expects parameter 1 to be string, array given in /home/org/public_html/blogcouture.info/wp-includes/formatting.php on line 2773

Warning: Cannot modify header information - headers already sent by (output started at /home/org/public_html/blogcouture.info/wp-includes/formatting.php:2773) in /home/org/public_html/blogcouture.info/wp-admin/includes/export.php on line 44

Warning: Cannot modify header information - headers already sent by (output started at /home/org/public_html/blogcouture.info/wp-includes/formatting.php:2773) in /home/org/public_html/blogcouture.info/wp-admin/includes/export.php on line 45

Warning: Cannot modify header information - headers already sent by (output started at /home/org/public_html/blogcouture.info/wp-includes/formatting.php:2773) in /home/org/public_html/blogcouture.info/wp-admin/includes/export.php on line 46

Change History (15)

comment:1 follow-up: nacin4 years ago

  • Keywords reporter-feedback added

The only error that matters is the strip_tags() one. I don't see this error, so we need to track down where it came from.

Can you go into wp-includes/formatting.php, find wp_strip_all_tags(), which is line 2771 in 3.0, and insert this as the first lines of the function:

if ( ! is_string( $string ) )
    var_dump( $string, debug_backtrace() );

That should be enough for us to track it down. Is this when trying to actually export, or just loading up the wp-admin/export.php screen?

comment:2 Leads4 years ago

  • Cc Leads added
  • Severity changed from normal to major

Thank goodness I found this trac.

Background: I have just installed Wordpress 3 on my localhost using XAMPP. I have created some custom post types (in my case, called "Projects").

I tried to export the xml file. Firstly, I had to install the WordPress Importer plugin.

Once that was installed, when I tried to export it, I got the same errors as dimitre, highlighted in bold below, and then it immediately goes into what I presume should be xml content

'''Warning: strip_tags() expects parameter 1 to be string, array given in C:\xampp\htdocs\newsite\wp-includes\formatting.php on line 2773

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\newsite\wp-includes\formatting.php:2773) in C:\xampp\htdocs\newsite\wp-admin\includes\export.php on line 44

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\newsite\wp-includes\formatting.php:2773) in C:\xampp\htdocs\newsite\wp-admin\includes\export.php on line 45

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\newsite\wp-includes\formatting.php:2773) in C:\xampp\htdocs\newsite\wp-admin\includes\export.php on line 46'''
http://localhost/newsite Just another WordPress

However, Nacin, the fix you suggest did not work. I now get this error above the original error

The error only shows when I try to export. /wp-admin/export.php loads fine.

array(2) { ["category"]=>  string(1) "0" ["post_tag"]=>  string(1) "0" } array(3) { [0]=>  array(4) { ["file"]=>  string(55) "C:\xampp\htdocs\newsite\wp-includes\formatting.php" ["line"]=>  int(766) ["function"]=>  string(17) "wp_strip_all_tags" ["args"]=>  array(1) { [0]=>  &array(2) { ["category"]=>  string(1) "0" ["post_tag"]=>  string(1) "0" } } } [1]=>  array(4) { ["file"]=>  string(47) "C:\xampp\htdocs\newsite\wp-admin\admin.php" ["line"]=>  int(89) ["function"]=>  string(12) "sanitize_key" ["args"]=>  array(1) { [0]=>  &array(2) { ["category"]=>  string(1) "0" ["post_tag"]=>  string(1) "0" } } } [2]=>  array(4) { ["file"]=>  string(48) "C:\xampp\htdocs\newsite\wp-admin\export.php" ["line"]=>  int(10) ["args"]=>  array(1) { [0]=>  string(47) "C:\xampp\htdocs\newsite\wp-admin\admin.php" } ["function"]=>  string(12) "require_once" } }
Warning: strip_tags() expects parameter 1 to be string, array given in C:\xampp\htdocs\newsite\wp-includes\formatting.php on line 2776

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\newsite\wp-includes\formatting.php:2773) in C:\xampp\htdocs\newsite\wp-admin\includes\export.php on line 44

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\newsite\wp-includes\formatting.php:2773) in C:\xampp\htdocs\newsite\wp-admin\includes\export.php on line 45

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\newsite\wp-includes\formatting.php:2773) in C:\xampp\htdocs\newsite\wp-admin\includes\export.php on line 46

I have read various blogs/forums saying about there being space in my wp-config file. However, my wp-config file does not have closing tag at the end. I thought this was this issue at first, but when checking other wordpress sites, there is no closign tag there either.

I attempted the whole export process again on a new WP3.0 install and the I get the same error.

I have changed the severity of this to 'major'. Apoligies if that is misusing this tracker, however, I need to have this sorted very soon.

Thanks,
Tom

comment:3 nacin4 years ago

This has nothing to do with wp-config.php whitespace or anything like that. The "headers already sent" error is due to the strip_tags() warning.

I didn't propose a fix; that was some debug code, and we now have a backtrace to work off of.

comment:4 Leads4 years ago

Ok, thanks for replying. I'll be checking this regularly for updates as I'm desperate for a fix :)

comment:5 nacin4 years ago

  • Keywords reporter-feedback removed
  • Milestone changed from Unassigned to 3.0.1
  • Priority changed from normal to highest omg bbq
  • Severity changed from major to blocker

Confirmed blocker. Working on a patch.

comment:6 nacin4 years ago

Okay, so, we added some code in [15175] that the export code trips over, as export.php also uses $_GET['taxonomy']...

Just a note, this *does* work on my testbed, in that the Warning output just gets stuffed into the XML file (something I missed when trying to reproduce this originally), though your situation is probably more common. (I'm not really sure why I'm not getting what you're getting, as the headers do get sent after content. I digress.) And, WordPress seems to not mind the cruft at the top of the file in an import, though I didn't look into that, and it does indicate that this bug would not affect servers with display_errors = off.

I'm committing a change, to both trunk and the branch, that will give the export.php fields unique names.

comment:7 nacin4 years ago

(In [15306]) Avoid variable clash in export.php. see #14026 for trunk.

comment:8 nacin4 years ago

(In [15307]) Revert typo. Thanks autocomplete for randomly modifying my file. see #14026.

comment:9 nacin4 years ago

(In [15308]) Avoid variable clash in export.php. see #14026 for 3.0.

comment:10 Leads4 years ago

Hi. Sorry, I've never used one of these trac things before.

Is there now a file I can test?

comment:11 nacin4 years ago

Going to leave this open so it can be reviewed in the morning.

Yes, you can go to http://core.trac.wordpress.org/browser/branches/3.0/wp-admin/export.php and download the "Original Format" or "Plain Text" file at the bottom of the page.

comment:12 Leads4 years ago

Hi.

That new export.php works! Thanks.

I do get the following error on my admin login page though, but that's the only place I've seen it so far, and I can login fine.

NULL array(4) { [0]=>  array(4) { ["file"]=>  string(56) "C:\xampp\htdocs\mysite\wp-includes\formatting.php" ["line"]=>  int(738) ["function"]=>  string(17) "wp_strip_all_tags" ["args"]=>  array(1) { [0]=>  &NULL } } [1]=>  array(4) { ["file"]=>  string(55) "C:\xampp\htdocs\mysite\wp-includes\pluggable.php" ["line"]=>  int(482) ["function"]=>  string(13) "sanitize_user" ["args"]=>  array(1) { [0]=>  &NULL } } [2]=>  array(4) { ["file"]=>  string(50) "C:\xampp\htdocs\mysite\wp-includes\user.php" ["line"]=>  int(51) ["function"]=>  string(15) "wp_authenticate" ["args"]=>  array(2) { [0]=>  &NULL [1]=>  &NULL } } [3]=>  array(4) { ["file"]=>  string(42) "C:\xampp\htdocs\mysite\wp-login.php" ["line"]=>  int(534) ["function"]=>  string(9) "wp_signon" ["args"]=>  array(2) { [0]=>  &string(0) "" [1]=>  &string(0) "" } } } 

comment:13 nacin4 years ago

That's the var_dump() you added, from my first comment. Remove that and you should be all set.

comment:14 nacin4 years ago

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

comment:15 in reply to: ↑ 1 dimitre4 years ago

Replying to nacin:

Sorry about the delay
This happens when I actually try to download export file
I've added the lines and here is the result:

array(2) {
  ["category"]=>
  string(1) "0"
  ["post_tag"]=>
  string(1) "0"
}
array(3) {
  [0]=>
  array(4) {
    ["file"]=>
    string(59) "/Users/dimitre/Sites/blogcouture/wp-includes/formatting.php"
    ["line"]=>
    int(766)
    ["function"]=>
    string(17) "wp_strip_all_tags"
    ["args"]=>
    array(1) {
      [0]=>
      &array(2) {
        ["category"]=>
        string(1) "0"
        ["post_tag"]=>
        string(1) "0"
      }
    }
  }
  [1]=>
  array(4) {
    ["file"]=>
    string(51) "/Users/dimitre/Sites/blogcouture/wp-admin/admin.php"
    ["line"]=>
    int(89)
    ["function"]=>
    string(12) "sanitize_key"
    ["args"]=>
    array(1) {
      [0]=>
      &array(2) {
        ["category"]=>
        string(1) "0"
        ["post_tag"]=>
        string(1) "0"
      }
    }
  }
  [2]=>
  array(4) {
    ["file"]=>
    string(52) "/Users/dimitre/Sites/blogcouture/wp-admin/export.php"
    ["line"]=>
    int(10)
    ["args"]=>
    array(1) {
      [0]=>
      string(51) "/Users/dimitre/Sites/blogcouture/wp-admin/admin.php"
    }
    ["function"]=>
    string(12) "require_once"
  }
}
Note: See TracTickets for help on using tickets.