From edf982fcd5a63e26139340fd2c6393ea51f368f5 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sun, 8 Mar 2015 23:00:21 +0000 Subject: [PATCH] Avoid function calls on each iteration of a `for` loop. See #30799. git-svn-id: https://develop.svn.wordpress.org/trunk@31678 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/formatting.php | 2 +- src/wp-includes/plugin.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index a18f79614c..4b5a90d3dc 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -1759,7 +1759,7 @@ function rawurlencode_deep( $value ) { */ function antispambot( $email_address, $hex_encoding = 0 ) { $email_no_spam_address = ''; - for ( $i = 0; $i < strlen( $email_address ); $i++ ) { + for ( $i = 0, $len = strlen( $email_address ); $i < $len; $i++ ) { $j = rand( 0, 1 + $hex_encoding ); if ( $j == 0 ) { $email_no_spam_address .= '&#' . ord( $email_address[$i] ) . ';'; diff --git a/src/wp-includes/plugin.php b/src/wp-includes/plugin.php index 3ec3a088d6..d3be2729d5 100644 --- a/src/wp-includes/plugin.php +++ b/src/wp-includes/plugin.php @@ -479,7 +479,7 @@ function do_action($tag, $arg = '') { $args[] =& $arg[0]; else $args[] = $arg; - for ( $a = 2; $a < func_num_args(); $a++ ) + for ( $a = 2, $num = func_num_args(); $a < $num; $a++ ) $args[] = func_get_arg($a); // Sort