Changeset 51818
- Timestamp:
- 09/15/2021 10:18:36 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/option.php
r51324 r51818 78 78 global $wpdb; 79 79 80 $option = trim( $option ); 80 if ( is_scalar( $option ) ) { 81 $option = trim( $option ); 82 } 83 81 84 if ( empty( $option ) ) { 82 85 return false; … … 379 382 global $wpdb; 380 383 381 $option = trim( $option ); 384 if ( is_scalar( $option ) ) { 385 $option = trim( $option ); 386 } 387 382 388 if ( empty( $option ) ) { 383 389 return false; … … 566 572 } 567 573 568 $option = trim( $option ); 574 if ( is_scalar( $option ) ) { 575 $option = trim( $option ); 576 } 577 569 578 if ( empty( $option ) ) { 570 579 return false; … … 688 697 global $wpdb; 689 698 690 $option = trim( $option ); 699 if ( is_scalar( $option ) ) { 700 $option = trim( $option ); 701 } 702 691 703 if ( empty( $option ) ) { 692 704 return false; -
trunk/tests/phpunit/tests/option/option.php
r51817 r51818 150 150 151 151 /** 152 * @ticket 53635 153 * 154 * @dataProvider data_valid_but_undesired_option_names 155 * 156 * @param mixed $option_name Option name. 157 */ 158 public function test_get_option_valid_but_undesired_option_names( $option_name ) { 159 $this->assertFalse( get_option( $option_name ) ); 160 } 161 162 /** 163 * @ticket 53635 164 * 165 * @dataProvider data_valid_but_undesired_option_names 166 * 167 * @param mixed $option_name Option name. 168 */ 169 public function test_add_option_valid_but_undesired_option_names( $option_name ) { 170 $this->assertTrue( add_option( $option_name, '' ) ); 171 } 172 173 /** 174 * @ticket 53635 175 * 176 * @dataProvider data_valid_but_undesired_option_names 177 * 178 * @param mixed $option_name Option name. 179 */ 180 public function test_update_option_valid_but_undesired_option_names( $option_name ) { 181 $this->assertTrue( update_option( $option_name, '' ) ); 182 } 183 184 /** 185 * @ticket 53635 186 * 187 * @dataProvider data_valid_but_undesired_option_names 188 * 189 * @param mixed $option_name Option name. 190 */ 191 public function test_delete_option_valid_but_undesired_option_names( $option_name ) { 192 $this->assertFalse( delete_option( $option_name ) ); 193 } 194 195 /** 196 * Data provider. 197 * 198 * @return array 199 */ 200 public function data_valid_but_undesired_option_names() { 201 return array( 202 'string 123' => array( '123' ), 203 'integer 123' => array( 123 ), 204 'integer -123' => array( -123 ), 205 'float 12.3' => array( 12.3 ), 206 'float -1.23' => array( -1.23 ), 207 'boolean true' => array( true ), 208 ); 209 } 210 211 /** 152 212 * @ticket 23289 153 213 */
Note: See TracChangeset
for help on using the changeset viewer.