Ticket #6346: 6346.hex.patch
File 6346.hex.patch, 1.7 KB (added by , 10 years ago) |
---|
-
src/bp-activity/bp-activity-functions.php
1661 1661 ? $r['action'] 1662 1662 : bp_activity_generate_action_string( $activity ); 1663 1663 1664 if ( ! $activity->save() ) { 1664 $success = $activity->save(); 1665 1666 // If the save failed, see if we can sanity check the main fields and try again 1667 if ( ! $success && is_callable( array( $GLOBALS['wpdb'], 'strip_invalid_text_for_column' ) ) ) { 1668 $fields = array( 'content' ); 1669 1670 foreach( $fields as $field ) { 1671 if ( isset( $activity->$field ) ) { 1672 $activity->$field = $GLOBALS['wpdb']->strip_invalid_text_for_column( buddypress()->activity->table_name, $field, $activity->$field ); 1673 } 1674 } 1675 1676 $success = $activity->save(); 1677 } 1678 1679 if ( ! $success ) { 1665 1680 return false; 1666 1681 } 1667 1682 -
tests/phpunit/testcases/activity/functions.php
5 5 class BP_Tests_Activity_Functions extends BP_UnitTestCase { 6 6 7 7 /** 8 * @ticket BP6346 9 */ 10 public function test_bp_activity_add_and_hex_a_to_f_characters() { 11 $a = $this->factory->activity->create( array( 12 'type' => 'activity_update', 13 14 // you can switch out %E9 with any A-F prefixed character. 15 // http://www.ascii.cl/htmlcodes.htm 16 'content' => urldecode( 'hey hey %E9' ) 17 ) ); 18 19 $this->assertNotFalse( $a, 'bp_activity_add() failed to insert content with hex A-F characters.' ); 20 } 21 22 /** 8 23 * @ticket BP4488 9 24 */ 10 25 public function test_thumbnail_content_images() {