#4538 closed defect (bug) (wontfix)
Invalid Argument in wp_add_post_tags loop
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.3.2 |
Component: | Import | Keywords: | foreach get_option utwimp tag2post |
Focuses: | Cc: |
Description
Watch that Third Step
Import Ultimate Tag Warrior
Steps may take a few minutes depending on the size of your database. Please be patient.
Adding Tags to Posts…
Warning: Invalid argument supplied for foreach() in /home/jcwinnie/public_html/wordpress/wp-admin/import/utw.php on line 209
Done! 0 tags where added!
Can you say foreach ( $posts as $this_post ) without $this_post being declared first?
Attachments (1)
Change History (10)
#6
@
17 years ago
- Resolution worksforme deleted
- Status changed from closed to reopened
- Version changed from 2.3 to 2.3.2
This error is still achievable with large amounts of post and tag data. We had it with about 16k post/tag relationships. The import wizard saves its data between server calls by using the wp_options table. On our server, the write command for that particular variable was failing, because it exceeded our MySQL maximum packet size (default is 1MB). So, the easy solution for those of you with this issue is to up your mysql max_allowed_packet (see http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html ).
The long term solution to this is probably to not use the wp_options table to store potentially large values. And honestly, it's not like this wizard requires any step-by-step interaction with the user, it could be combined into a single script and remove the need for storing values there anyways.
The solution suggested by pgdx (forcing $posts to be cast as an array) doesn't actually help anything, it just removes the error. If $posts is empty or null (as is the case when the option wasn't saved) this will just end up with an array that contains a single null value. No importing would actually happen in this case.
#8
@
16 years ago
- Component changed from Administration to Import
- Milestone 2.9 deleted
- Resolution set to wontfix
- Status changed from reopened to closed
has been rotting for too long
Yes, you can say that without declaring it. You may get that error message if the $posts is null.