bug in post-template.php
|Reported by:||crysman||Owned by:|
There is a bug in wp-includes/post-template.php, line 208:
if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) ) ...
$post variable is being inicialized on line 183 like this:
$post = get_post();
What is wrong is that get_post() may return NULL, and it sometimes does. So the code
is obviously incorrect, because it is trying to access an object, which does not exist. Therefore, you get a PHP notice, thus getting "header already send" errors...
is simple - just check first if non-empty:
if(!empty($post)) if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) ) ...
Change History (7)
comment:5 @Frank Klein — 2 years ago
- Cc contact@… added
- Keywords needs-patch removed
- Resolution set to invalid
- Status changed from new to closed
comment:6 @SergeyBiryukov — 2 years ago
- Milestone Awaiting Review deleted
- Resolution changed from invalid to wontfix