Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#20296 closed feature request (wontfix)

WP_Query implements Countable

Reported by: hakre's profile hakre Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch close
Focuses: Cc:

Description

Giving WP_Query the Countable interface would allow to deal with it more fluently the "PHP way".

Attachments (1)

20296.diff (656 bytes) - added by hakre 12 years ago.

Download all attachments as: .zip

Change History (8)

@hakre
12 years ago

#1 @hakre
12 years ago

Related: #20297

#2 @GaryJ
12 years ago

  • Keywords close added

Although in the default compilation since PHP 5.0, until PHP 5.3 PHP can be compiled without the SPL, so it's not guaranteed to have the interface always present. I suspect that referencing a non-defined interface would cause a fatal error for those (few) that don't have the SPL compiled in PHP.

#3 follow-up: @johnbillion
12 years ago

  • Keywords reporter-feedback added

Similarly to #20297, what is the use case for this? The patch as-is achieves nothing. If WP_Query is to implement the countable interface then your patch should include the corresponding code changes which take advantage of it, otherwise the change is pointless.

#4 @nacin
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Since SPL can be disabled, this is definitely wontfix. I will comment more on the idea in #20297.

#5 in reply to: ↑ 3 @hakre
12 years ago

  • Keywords reporter-feedback removed

Replying to GaryJ:

Although in the default compilation since PHP 5.0, until PHP 5.3 PHP can be compiled without the SPL, so it's not guaranteed to have the interface always present. I suspect that referencing a non-defined interface would cause a fatal error for those (few) that don't have the SPL compiled in PHP.

There is more in PHP that can be disabled which will break Wordpress even the minimum requirements don't show that picture. So generally this would need a review whether or not PHP is commonly compiled without the SPL. That is commonly not the case, the SPL is available everywhere by default and it's safe to expect it that way.

Replying to johnbillion:

Similarly to #20297, what is the use case for this?

The usage is obvious I'd say. See PHP Manual for details of the interface.

#6 follow-up: @dd32
12 years ago

There is more in PHP that can be disabled which will break Wordpress even the minimum requirements don't show that picture.

Such as? Other than the MySQL extension, we've got back-compat functionality available for the (compiled by default) json and hmac components, and don't use several other default items which are often disabled.

SPL is, from memory, more commonly disabled than both the above.

#7 in reply to: ↑ 6 @hakre
12 years ago

Replying to dd32:

Such as?

For example PCRE.

SPL is, from memory, more commonly disabled than both the above.

SPL more often disabled than json? Never encountered that, but well, memory indeed can serve wrong, before introducing that a metric should be run first, good old Json has taught that lesson in the past (#16918, #18015).

Last edited 12 years ago by hakre (previous) (diff)
Note: See TracTickets for help on using tickets.