[wp-trac] [WordPress Trac] #31820: get_option() returns Integers as strings

WordPress Trac noreply at wordpress.org
Tue Mar 31 12:41:28 UTC 2015


#31820: get_option() returns Integers as strings
--------------------------------+-----------------------------
 Reporter:  golderweb           |      Owner:
     Type:  enhancement         |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Options, Meta APIs  |    Version:  4.1.1
 Severity:  normal              |   Keywords:
  Focuses:                      |
--------------------------------+-----------------------------
 For Options which are [https://codex.wordpress.org/Option_Reference
 declared to be Integers there], get_options() always returns the Integer
 as a string like this:

 $value = get_option( 'comment_max_links' );
 var_dump( $value );

 ----
 Result:

 string '2'

 Maybe it would be more intuitive if get_option would return an integer
 since is_int() will return "FALSE" on "integer-strings".
 Otherwise the [https://codex.wordpress.org/Option_Reference
 Option_Reference] and the
 [https://codex.wordpress.org/Function_Reference/get_option Function
 Reference] should be changed to something like "numeric-string".

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31820>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list