WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#6669 closed defect (bug) (fixed)

Notices when WP_DEBUG is set

Reported by: simonwheatley Owned by: westi
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.5
Component: Administration Keywords:
Focuses: Cc:

Description

Steps to reproduce:

  1. Define the constant WP_DEBUG in wp_config.php
  1. Select the edit link from a single post page which has no tags
  1. Check the PHP error log, and you should see:

Notice:Undefined variable: _wp_original_http_referrer in /Users/simon/Projects/WordPress-2.5/site/wp-admin/edit-form-advanced.php:6

Notice:Undefined variable: original_title in /Users/simon/Projects/WordPress-2.5/site/wp-admin/includes/post.php:639

Notice:Undefined property: stdClass::$args in /Users/simon/Projects/WordPress-2.5/site/wp-includes/taxonomy.php:1066

Notice:Undefined offset: 2 in /Users/simon/Projects/WordPress-2.5/site/wp-includes/rewrite.php(140) : eval()'d code:1

Notice:Undefined index: _wp_original_http_referer in /Users/simon/Projects/WordPress-2.5/site/wp-admin/edit-page-form.php:4

Notice:Undefined variable: temp_ID in /Users/simon/Projects/WordPress-2.5/site/wp-admin/edit-page-form.php:26

Notice:Undefined variable: post_ID in /Users/simon/Projects/WordPress-2.5/site/wp-admin/edit-page-form.php:32

The proposed patch, edit_posts_no_tags.patch, supresses the errors caused by trying to access unset $_GET vars, sets or tests other vars/properties before using them in I statements, lowers the error reporting before evaling $query in rewrite.php

Attachments (3)

edit.patch (4.4 KB) - added by simonwheatley 7 years ago.
Patch to reduce Notices when creating and editing pages/posts
6669.r8571.patch (16.2 KB) - added by santosj 7 years ago.
Fix massive amount of notices in wp-includes and wp-admin
6669.r8584.patch (24.4 KB) - added by santosj 7 years ago.
Fixes a lot of notices in wp-admin and wp-includes directories with suggestion from Ryan, based off of r8584

Download all attachments as: .zip

Change History (22)

@simonwheatley7 years ago

Patch to reduce Notices when creating and editing pages/posts

comment:1 @westi7 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 2.5.1 to 2.6
  • Owner changed from anonymous to westi
  • Status changed from new to assigned

2.6 is a more appropriate target for these fixes.

Just adding @ is not the right fix.

comment:2 @jacobsantos7 years ago

This most likely was fixed with another notices patch. I think there should only be one ticket for notices and warnings fixes per WordPress version.

comment:3 @jacobsantos7 years ago

  • Summary changed from Editing a post or page throws various Notices when WP_DEBUG is set to Notices when WP_DEBUG is set

comment:8 @jacobsantos7 years ago

  • Milestone changed from 2.9 to 2.7

@santosj7 years ago

Fix massive amount of notices in wp-includes and wp-admin

comment:9 @santosj7 years ago

Patch corrects a lot of notices.

comment:10 @santosj7 years ago

  • Keywords has-patch tested added; needs-patch needs-testing removed

comment:11 follow-up: @ryan7 years ago

How about adding this to the top of the edit forms so that we don't have to do a bunch of isset checks later on?

if ( !isset($foo_id) )
    $foo_id = 0;

comment:12 in reply to: ↑ 11 @santosj7 years ago

  • Keywords needs-patch added; has-patch tested removed

Replying to ryan:

How about adding this to the top of the edit forms so that we don't have to do a bunch of isset checks later on?

Indeed.

comment:13 @santosj7 years ago

  • Cc jacobsantos added

@santosj7 years ago

Fixes a lot of notices in wp-admin and wp-includes directories with suggestion from Ryan, based off of r8584

comment:14 @santosj7 years ago

  • Keywords has-patch tested needs-testing added; needs-patch removed

I did test the changes, but there might be some odd side effects possible with some changes. Works for me! Some pages are unusable without patch when using WP_DEBUG. We should encourage its use, but I really can't see how people will be able to use it.

There will need to be several more patches to cover the full scope of all of the Administration Panel pages, as well as the visitor pages.

comment:15 @westi7 years ago

Throwing the current patch at trunk.

comment:16 @westi7 years ago

(In [8589]) Lots of fixes for Notices when WP_DEBUG is set. See #6669 props santosj.

comment:17 @santosj7 years ago

Patch in this ticket fixed issues found in #7411.

comment:18 @santosj7 years ago

  • Keywords needs-patch added; has-patch tested needs-testing removed

comment:19 @santosj7 years ago

  • Keywords needs-patch removed
  • Resolution set to fixed
  • Status changed from assigned to closed

See #7509 for updated patch for WordPress notices.

Note: See TracTickets for help on using tickets.