WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 4 years ago

#6665 closed defect (bug) (fixed)

Evaling the $query in Class WP throws a notice

Reported by: simonwheatley Owned by:
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.5
Component: Warnings/Notices Keywords: needs-patch reporter-feedback
Focuses: Cc:

Description

I've just turned on the WP_DEBUG (#5033), for more picky error handling and am making an effort to clean up my WP install to run with no errors of any kind (not even Notices).

The evaling of $query in the Class WP throws a Notice as all indexes in $matches are not always returned by the above preg_match. How about suppressing errors in that eval (see attached patch, query_error_suppress.patch)? If suppressing errors is not preferred, how about lowering the error_handling at that point to ignore Notices (see attached patch, query_notice_ignore.patch)?

I prefer ignoring Notices temporarily, as it allows other errors to be caught and logged.

Attachments (2)

query_error_suppress.patch (416 bytes) - added by simonwheatley 6 years ago.
Query error suppression option
query_notice_ignore.patch (766 bytes) - added by simonwheatley 6 years ago.
Query notice ignore option

Download all attachments as: .zip

Change History (12)

simonwheatley6 years ago

Query error suppression option

simonwheatley6 years ago

Query notice ignore option

comment:1 simonwheatley6 years ago

Forgot to add steps to reproduce:

  1. Define the constant "WP_DEBUG" in your wp_config.php
  1. Access a page in your Wordpress installation
  1. (Open the PHP error log if you're not tailing it)
  1. See the Notice, similar to:

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

comment:2 simonwheatley6 years ago

  • Cc simon@… added

comment:3 ryan6 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

comment:4 Denis-de-Bernardy5 years ago

  • Component changed from General to Warnings/Notices
  • Owner anonymous deleted

comment:5 Denis-de-Bernardy5 years ago

  • Keywords 2nd-opinion removed

see also: #9602

comment:6 Denis-de-Bernardy5 years ago

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

why not add isset() statements as needed?

comment:7 dd325 years ago

  • Version set to 2.5

why not add isset() statements as needed?

...I'm not sure that'll work..

What i'm more interested in however, is what rewrite rule is throwing the noticed (If its still even current), In reality, if the rewrite rule is being matched, but not returning anything, then a few more specific rules are probably needed before the main one.. it results in simpler rules as well as not having this problem..

Is this still current? I've never seen any notices of the such under core trunk without any dodgy plugins.

comment:8 hakre5 years ago

  • Keywords reporter-feedback added

At least steps to reproduce are needed.

comment:9 Denis-de-Bernardy5 years ago

fixed along with #9602, no?

comment:10 azaozz4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Yes, think so.

Note: See TracTickets for help on using tickets.