Make WordPress Core

Opened 14 years ago

Closed 11 years ago

#17072 closed enhancement (maybelater)

Make $wp_query->query read-only

Reported by: scribu's profile scribu Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Query Keywords: has-patch
Focuses: Cc:

Description

WP_Query has two properties that contain query vars:

$wp_query->query is the initial query.

$wp_query->query_vars is the "working copy", with all possible query vars filled.

I propose we prevent modification of $wp_query->query and keep it as a signature of that particular instance.

Attachments (1)

17072.diff (588 bytes) - added by scribu 14 years ago.

Download all attachments as: .zip

Change History (6)

@scribu
14 years ago

#1 @scribu
14 years ago

Note that attempts to modify $wp_query->query will just trigger a notice:

Notice: Indirect modification of overloaded property WP_Query::$query has no effect ...

#2 @westi
14 years ago

We already discussed in IRC how we can't really make anything private that wasn't private before because it could break plugin functionality.

While this won't cause a WSOD it could break sites.

#3 @scribu
14 years ago

We're not making it private, just read-only.

You can still call if ( 'bar' == $wp_query->query['foo'] ) etc.

Last edited 14 years ago by scribu (previous) (diff)

#4 @wonderboymusic
11 years ago

  • Keywords close added; dev-feedback removed

@scribu, do you still feel this way? leaving this open for discussion

#5 @wonderboymusic
11 years ago

  • Keywords close removed
  • Milestone Future Release deleted
  • Resolution set to maybelater
  • Status changed from new to closed

Not a lot of action here

Note: See TracTickets for help on using tickets.