[wp-trac] [WordPress Trac] #25308: wp_cache_set, wp_cache_add, set_transient should handle and notify on non-ints expirations

WordPress Trac noreply at wordpress.org
Fri Sep 13 21:25:45 UTC 2013


#25308: wp_cache_set, wp_cache_add, set_transient should handle and notify on non-
ints expirations
------------------------------------+--------------------
 Reporter:  andreasnrb              |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  3.7
Component:  Cache                   |     Version:  3.6.1
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |
------------------------------------+--------------------

Comment (by andreasnrb):

 When using drop in with for example APC, APC will throw message
 "apc_store() expects parameter 3 to be long, string given". No drop-ins
 for APC handles wrong expiration type as far as I know.

 And with regards to setting it can be when the data is user input, users
 fills out a text field that is not validated. Also typecasting to 0 is not
 always the best thing since that would not give the developer any hint
 that they are passing a wrong expiration in the first place.

 @tollmanzs
 "Changing this in the core class would only serve to warning devs, but
 would not actually fix the problem."
 The whole point is to warn devs. There are other areas in WP that call
 doing it wrong to notificy developers. End users don't care, they dont
 want any messages at all. At least by adding this there is some covering
 of ones bases. The point is to give devs in case they do it wrong a heads
 up. It breaks intended functionality when it happens.

 @c3digital
 "Currently plugin and theme developers pass strings and other types as
 expirations"
 Should have written "can" and in some cases it does happen. Cant do a
 search like that you need to check variables and where they originate
 from. Point is APC and perhaps other cache engines don't accept strings or
 other types. They give warning. I think WordPress should do the same to
 promote better developer methodology.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25308#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list