[wp-trac] [WordPress Trac] #8389: $post->post_parent becoming an
object
WordPress Trac
wp-trac at lists.automattic.com
Thu Nov 27 05:06:20 GMT 2008
#8389: $post->post_parent becoming an object
----------------------------+-----------------------------------------------
Reporter: janbrasna | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.7
Component: Administration | Version: 2.7
Severity: blocker | Keywords: post object global scope class borked
----------------------------+-----------------------------------------------
- WP 2.7-beta3, upgraded from 2.6.2
- Apache 2.2.9, PHP 5.2.6, MySQL 5.0.67-community-log, Linux (Kernel
2.6.27-6_1.intel.BHsmp)
Once I go to Admin > Edit Pages, if there are any sub-pages (i.e.
$post->post_parent != 0), I get:
Catchable fatal error: Object of class stdClass could not be converted to
string in [...]/wp-admin/includes/template.php on line 1177
What happens there is that the value of $post->post_parent is not an
integer at that point but a class containing the whole parent post object,
not just the ID. It traces back to display_page_row(), where the value get
massaged in "title" case section, when the get_permalink() is called. From
there the clues lead to get_page_link, then to get_page_uri() that I've
isolated as the cause, but since the ID is referenced, I'm lost at that
point. It seems to explode after doing get_page and then get_post and
overwriting or referencing the wrong scope of $page, dunno.
I've tried pretty much everything I could (killing references, cloning
objects, killing globals) in the last couple of hours, but nothing helped.
So I went back to template.php and instead of get_permalink($page->ID)
I've just temporarily hardcoded /?p=$page->ID to be able to use the admin.
And well, the question is ... what the hell? ;) Is it just my case, or
someone could replicate the issue on 2.7 B3? Could the fact I've upgraded
from 2.6 be a factor?
--
Ticket URL: <http://trac.wordpress.org/ticket/8389>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list