From 0152b8f49bf5185fe9463863d3cb62c2d7f10d71 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 27 Apr 2015 14:41:48 +0000 Subject: [PATCH] In [32299], we should be using `mb_strlen()` for our string size checks. git-svn-id: https://develop.svn.wordpress.org/trunk@32306 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/wp-db.php | 2 +- tests/phpunit/tests/comment.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php index c49396dc65..0bd7a1882b 100644 --- a/src/wp-includes/wp-db.php +++ b/src/wp-includes/wp-db.php @@ -2064,7 +2064,7 @@ class wpdb { } } - if ( false !== $value['length'] && strlen( $value['value'] ) > $value['length'] ) { + if ( false !== $value['length'] && mb_strlen( $value['value'] ) > $value['length'] ) { return false; } diff --git a/tests/phpunit/tests/comment.php b/tests/phpunit/tests/comment.php index 3905f9f461..dbb01856ab 100644 --- a/tests/phpunit/tests/comment.php +++ b/tests/phpunit/tests/comment.php @@ -137,5 +137,12 @@ class Tests_Comment extends WP_UnitTestCase { $id = wp_new_comment( $data ); $this->assertFalse( $id ); + + // Cleanup. + if ( isset( $remote_addr ) ) { + $_SERVER['REMOTE_ADDR'] = $remote_addr; + } else { + unset( $_SERVER['REMOTE_ADDR'] ); + } } }