Changeset 56788
- Timestamp:
- 10/05/2023 04:13:38 PM (17 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/option.php
r56717 r56788 806 806 * See https://core.trac.wordpress.org/ticket/38903 and https://core.trac.wordpress.org/ticket/22192. 807 807 */ 808 if ( $raw_old_value !== $default_value && _is_equal_database_value( $raw_old_value, $value ) ) { 808 if ( 809 $value === $raw_old_value || 810 ( 811 $raw_old_value !== $default_value && 812 _is_equal_database_value( $raw_old_value, $value ) 813 ) 814 ) { 809 815 return false; 810 816 } -
trunk/tests/phpunit/tests/option/option.php
r56762 r56788 640 640 '(float) 0.0' => array( 0.0, 0.0 ), 641 641 'empty array' => array( array(), array() ), 642 'false' => array( false, false ), 642 643 643 644 /* 644 * false and null are not included in these datasets645 * becausefalse is the default value, which triggers645 * null is not included in these datasets because 646 * false is the default value, which triggers 646 647 * a call to add_option(). 647 648 * … … 680 681 public function data_stored_as_empty_string() { 681 682 return array( 682 'false' => array( false ),683 683 'empty string' => array( '' ), 684 684 'null' => array( null ), … … 706 706 ); 707 707 708 $this->assertTrue( update_option( $option, $default_value ), 'update_option() should have returned true.' ); 708 /* 709 * For a non existing option with the unfiltered default of false, passing false here wouldn't work. 710 * Because the default is different than false here though, passing false is expected to result in 711 * a database update. 712 */ 713 $this->assertTrue( update_option( $option, false ), 'update_option() should have returned true.' ); 709 714 710 715 $actual = $wpdb->get_row( … … 717 722 $this->assertIsObject( $actual, 'The option was not added to the database.' ); 718 723 $this->assertObjectHasProperty( 'option_value', $actual, 'The "option_value" property was not included.' ); 719 $this->assertSame( $default_value, $actual->option_value, 'The value was not stored as an empty string.' );724 $this->assertSame( '', $actual->option_value, 'The new value was not stored in the database.' ); 720 725 } 721 726
Note: See TracChangeset
for help on using the changeset viewer.