[wp-trac] [WordPress Trac] #6508: Gallery does not work on my hosting

WordPress Trac wp-trac at lists.automattic.com
Mon Mar 31 17:44:19 GMT 2008


#6508: Gallery does not work on my hosting
---------------------+------------------------------------------------------
 Reporter:  Dickie   |       Owner:  anonymous
     Type:  defect   |      Status:  new      
 Priority:  normal   |   Milestone:  2.7      
Component:  General  |     Version:           
 Severity:  normal   |    Keywords:           
---------------------+------------------------------------------------------
 I'm not sure of the difference, but on my hosting (and others as well as
 seen here [http://wordpress.org/support/topic/163938?replies=7]) the
 Gallery function does not work.
 I get a php error

 {{{
 [31-Mar-2008 07:32:03] WordPress database error You have an error in your
 SQL syntax; check the manual that corresponds to your MySQL server version
 for the right syntax to use near '\"menu_order ASC, ID ASC\" DESC' at line
 1 for query SELECT DISTINCT * FROM wp_posts  WHERE 1=1 AND post_type =
 'attachment'   AND wp_posts.post_parent = 15  AND (post_mime_type LIKE
 'image/%')  GROUP BY wp_posts.ID ORDER BY \"menu_order ASC, ID ASC\" DESC
 made by get_posts
 }}}
 In the investigation that I have done, this seems to be related to the
 call to get children in gallery_shortcode function in wp-
 includes/media.php

 {{{
 $attachments =
 get_children("post_parent=$id&post_type=attachment&post_mime_type=image&orderby=\"{$orderby}\"");
 }}}

 As far as I can see the {$orderby} should not be in quotes, and also the
 order parameter should be overridden as the function get_posts in post.php
 adds DESC to the end anyway.

 All in all we end up with this
 {{{
 ORDER BY \"menu_order ASC, ID ASC\" DESC
 }}}
 being sent to SQL and it has a hissy fit !!

 What I am not sure about is why this code seems to work for some people,
 and also on my WAMP setup on my own PC...?

 I will try to come up with a patch, but in the mean time, I thought I
 ought to inform the world.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6508>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list