[wp-trac] [WordPress Trac] #13753: get_page() breaking $post when it's called with empty parameter
WordPress Trac
wp-trac at lists.automattic.com
Mon Jun 7 23:11:59 UTC 2010
#13753: get_page() breaking $post when it's called with empty parameter
--------------------------+-------------------------------------------------
Reporter: shidouhikari | Owner: westi
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 3.0
Component: General | Version: 3.0
Severity: normal | Keywords: has-patch
--------------------------+-------------------------------------------------
Comment(by shidouhikari):
{{{
<?php
global $post;
echo '<p>$post before calling get_post($post):</p>';
var_dump($post);
$getPost = get_post($post);
echo '<p>get_post($post):</p>';
var_dump($getPost);
echo '<p>$post after calling get_post($post):</p>';
var_dump($post);
?>
}}}
Yeah, if get_post() receives global $post as parameter it bugs. Assigning
global $post somewhere and later using get_post() to format it breaks the
global variable.
It's very rare to happen, but if somebody does it, other codes will be
affected.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/13753#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list