aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_convert.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2016-04-02 09:46:54 +0200
committerMarc Alexander <admin@m-a-styles.de>2016-04-02 09:46:54 +0200
commit5b61ac06cbb065d0e5d6c0c108ead96cea0c3333 (patch)
tree0eb30c021770286205be0489c3412a8613b8965d /phpBB/includes/functions_convert.php
parent3f5a873e4cff0fd6f9ab2dd4fad1179009abed4b (diff)
downloadforums-5b61ac06cbb065d0e5d6c0c108ead96cea0c3333.tar
forums-5b61ac06cbb065d0e5d6c0c108ead96cea0c3333.tar.gz
forums-5b61ac06cbb065d0e5d6c0c108ead96cea0c3333.tar.bz2
forums-5b61ac06cbb065d0e5d6c0c108ead96cea0c3333.tar.xz
forums-5b61ac06cbb065d0e5d6c0c108ead96cea0c3333.zip
[ticket/14577] Do not calculate size of array in for loop
For loops that modify the size of the looped arrays were obviously not changed. PHPBB3-14577
Diffstat (limited to 'phpBB/includes/functions_convert.php')
-rw-r--r--phpBB/includes/functions_convert.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index b380273f0c..da4820134d 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -479,7 +479,7 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false
$dir->close();
}
- for ($i = 0; $i < sizeof($dirlist); ++$i)
+ for ($i = 0, $end = sizeof($dirlist); $i < $end; ++$i)
{
$dir = $dirlist[$i];
@@ -1427,7 +1427,7 @@ function get_path($src_path, $src_url, $test_file)
$path_array = array();
$phpbb_parts = explode('/', $script_path);
- for ($i = 0; $i < sizeof($url_parts); ++$i)
+ for ($i = 0, $end = sizeof($url_parts); $i < $end; ++$i)
{
if ($i < sizeof($phpbb_parts[$i]) && $url_parts[$i] == $phpbb_parts[$i])
{
@@ -1437,7 +1437,7 @@ function get_path($src_path, $src_url, $test_file)
else
{
$path = '';
- for ($j = $i; $j < sizeof($phpbb_parts); ++$j)
+ for ($j = $i, $end2 = sizeof($phpbb_parts); $j < $end2; ++$j)
{
$path .= '../';
}
@@ -2269,7 +2269,7 @@ function convert_bbcode($message, $convert_size = true, $extended_bbcodes = fals
"\n\n"
);
- for ($i = 0; $i < sizeof($str_from); ++$i)
+ for ($i = 0, $end = sizeof($str_from); $i < $end; ++$i)
{
$origx[] = '#\\' . str_replace(']', '\\]', $str_from[$i]) . '#is';
$replx[] = $str_to[$i];
@@ -2278,7 +2278,7 @@ function convert_bbcode($message, $convert_size = true, $extended_bbcodes = fals
if (preg_match_all('#\[email=([^\]]+)\](.*?)\[/email\]#i', $message, $m))
{
- for ($i = 0; $i < sizeof($m[1]); ++$i)
+ for ($i = 0, $end = sizeof($m[1]); $i < $end; ++$i)
{
if ($m[1][$i] == $m[2][$i])
{
@@ -2339,7 +2339,7 @@ function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $sour
$parts = explode('/', $trg);
unset($parts[sizeof($parts) - 1]);
- for ($i = 0; $i < sizeof($parts); ++$i)
+ for ($i = 0, $end = sizeof($parts); $i < $end; ++$i)
{
$path .= $parts[$i] . '/';
@@ -2436,7 +2436,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_
if ($copy_subdirs)
{
- for ($i = 0; $i < sizeof($dirlist); ++$i)
+ for ($i = 0, $end = sizeof($dirlist); $i < $end; ++$i)
{
$dir = $dirlist[$i];
@@ -2471,7 +2471,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_
$convert->p_master->error(sprintf($str, implode('<br />', $bad_dirs)), __LINE__, __FILE__);
}
- for ($i = 0; $i < sizeof($filelist); ++$i)
+ for ($i = 0, $end = sizeof($filelist); $i < $end; ++$i)
{
copy_file($src . $filelist[$i], $trg . $filelist[$i], $overwrite, $die_on_failure, $source_relative_path);
}