From 797234e416c40cd602f9ee46d63bff53de303800 Mon Sep 17 00:00:00 2001 From: rxu Date: Wed, 28 Jun 2017 00:58:03 +0700 Subject: [PATCH] [ticket/14972] replace all occurrences of sizeof() with the count() PHPBB3-14972 --- build/build_helper.php | 4 +- build/package.php | 16 ++-- phpBB/develop/add_permissions.php | 4 +- phpBB/develop/check_flash_bbcodes.php | 2 +- phpBB/develop/create_variable_overview.php | 4 +- phpBB/develop/search_fill.php | 2 +- phpBB/docs/coding-guidelines.html | 8 +- phpBB/includes/acp/acp_attachments.php | 56 ++++++------- phpBB/includes/acp/acp_bbcodes.php | 2 +- phpBB/includes/acp/acp_board.php | 6 +- phpBB/includes/acp/acp_bots.php | 14 ++-- phpBB/includes/acp/acp_database.php | 12 +-- phpBB/includes/acp/acp_email.php | 14 ++-- phpBB/includes/acp/acp_forums.php | 50 +++++------ phpBB/includes/acp/acp_groups.php | 10 +-- phpBB/includes/acp/acp_help_phpbb.php | 2 +- phpBB/includes/acp/acp_icons.php | 16 ++-- phpBB/includes/acp/acp_inactive.php | 2 +- phpBB/includes/acp/acp_language.php | 2 +- phpBB/includes/acp/acp_logs.php | 4 +- phpBB/includes/acp/acp_main.php | 2 +- phpBB/includes/acp/acp_modules.php | 8 +- phpBB/includes/acp/acp_permission_roles.php | 4 +- phpBB/includes/acp/acp_permissions.php | 78 +++++++++--------- phpBB/includes/acp/acp_profile.php | 28 +++---- phpBB/includes/acp/acp_prune.php | 18 ++-- phpBB/includes/acp/acp_reasons.php | 6 +- phpBB/includes/acp/acp_search.php | 10 +-- phpBB/includes/acp/acp_users.php | 44 +++++----- phpBB/includes/acp/auth.php | 36 ++++---- phpBB/includes/bbcode.php | 6 +- phpBB/includes/diff/diff.php | 80 +++++++++--------- phpBB/includes/diff/engine.php | 10 +-- phpBB/includes/diff/renderer.php | 24 +++--- phpBB/includes/functions_admin.php | 2 +- phpBB/includes/functions_compress.php | 6 +- phpBB/includes/functions_content.php | 20 ++--- phpBB/includes/functions_convert.php | 50 +++++------ phpBB/includes/functions_display.php | 10 +-- phpBB/includes/functions_download.php | 2 +- phpBB/includes/functions_jabber.php | 16 ++-- phpBB/includes/functions_mcp.php | 12 +-- phpBB/includes/functions_messenger.php | 34 ++++---- phpBB/includes/functions_module.php | 6 +- phpBB/includes/functions_posting.php | 46 +++++------ phpBB/includes/functions_privmsgs.php | 66 +++++++-------- phpBB/includes/functions_transfer.php | 2 +- phpBB/includes/mcp/mcp_ban.php | 2 +- phpBB/includes/mcp/mcp_forum.php | 20 ++--- phpBB/includes/mcp/mcp_logs.php | 4 +- phpBB/includes/mcp/mcp_main.php | 82 +++++++++---------- phpBB/includes/mcp/mcp_pm_reports.php | 10 +-- phpBB/includes/mcp/mcp_post.php | 10 +-- phpBB/includes/mcp/mcp_queue.php | 38 ++++----- phpBB/includes/mcp/mcp_reports.php | 32 ++++---- phpBB/includes/mcp/mcp_topic.php | 24 +++--- phpBB/includes/message_parser.php | 40 ++++----- phpBB/includes/ucp/ucp_attachments.php | 8 +- phpBB/includes/ucp/ucp_auth_link.php | 4 +- phpBB/includes/ucp/ucp_groups.php | 18 ++-- phpBB/includes/ucp/ucp_main.php | 12 +-- phpBB/includes/ucp/ucp_notifications.php | 2 +- phpBB/includes/ucp/ucp_pm_compose.php | 40 ++++----- phpBB/includes/ucp/ucp_pm_options.php | 2 +- phpBB/includes/ucp/ucp_pm_viewfolder.php | 8 +- phpBB/includes/ucp/ucp_pm_viewmessage.php | 8 +- phpBB/includes/ucp/ucp_prefs.php | 8 +- phpBB/includes/ucp/ucp_profile.php | 26 +++--- phpBB/includes/ucp/ucp_register.php | 10 +-- phpBB/includes/ucp/ucp_zebra.php | 26 +++--- phpBB/includes/utf/utf_tools.php | 2 +- .../install/convert/controller/convertor.php | 4 +- phpBB/install/convert/convertor.php | 24 +++--- .../install/convertors/functions_phpbb20.php | 8 +- phpBB/mcp.php | 4 +- phpBB/memberlist.php | 18 ++-- phpBB/phpbb/attachment/resync.php | 4 +- phpBB/phpbb/attachment/upload.php | 2 +- phpBB/phpbb/auth/auth.php | 10 +-- phpBB/phpbb/auth/provider/ldap.php | 4 +- phpBB/phpbb/auth/provider/oauth/oauth.php | 2 +- phpBB/phpbb/avatar/driver/local.php | 2 +- phpBB/phpbb/avatar/driver/upload.php | 8 +- phpBB/phpbb/cache/driver/base.php | 6 +- phpBB/phpbb/cache/driver/file.php | 4 +- phpBB/phpbb/cache/driver/memory.php | 2 +- phpBB/phpbb/cache/service.php | 2 +- phpBB/phpbb/captcha/char_cube3d.php | 2 +- phpBB/phpbb/captcha/colour_manager.php | 2 +- phpBB/phpbb/captcha/gd.php | 54 ++++++------ .../captcha/plugins/captcha_abstract.php | 2 +- phpBB/phpbb/captcha/plugins/qa.php | 16 ++-- .../console/command/thumbnail/delete.php | 2 +- phpBB/phpbb/content_visibility.php | 10 +-- phpBB/phpbb/db/driver/mssqlnative.php | 2 +- phpBB/phpbb/db/driver/oracle.php | 6 +- phpBB/phpbb/db/extractor/mssql_extractor.php | 4 +- phpBB/phpbb/db/extractor/oracle_extractor.php | 4 +- .../migration/data/v310/style_update_p1.php | 2 +- .../phpbb/db/migration/data/v310/teampage.php | 4 +- phpBB/phpbb/db/migration/tool/config.php | 2 +- phpBB/phpbb/db/migration/tool/config_text.php | 2 +- phpBB/phpbb/db/migration/tool/module.php | 4 +- phpBB/phpbb/db/migration/tool/permission.php | 2 +- phpBB/phpbb/db/migrator.php | 4 +- phpBB/phpbb/db/sql_insert_buffer.php | 4 +- phpBB/phpbb/db/tools/mssql.php | 2 +- phpBB/phpbb/event/md_exporter.php | 6 +- phpBB/phpbb/event/php_exporter.php | 12 +-- phpBB/phpbb/files/filespec.php | 6 +- phpBB/phpbb/files/types/form.php | 2 +- phpBB/phpbb/files/types/local.php | 2 +- phpBB/phpbb/filesystem/filesystem.php | 8 +- phpBB/phpbb/install/helper/database.php | 2 +- .../helper/iohandler/ajax_iohandler.php | 6 +- .../module/install_data/task/add_bots.php | 2 +- .../module/install_data/task/add_modules.php | 2 +- .../task/add_config_settings.php | 2 +- .../task/add_default_data.php | 2 +- .../install_database/task/add_tables.php | 2 +- .../task/install_extensions.php | 2 +- .../task/update_extensions.php | 2 +- .../update_filesystem/task/diff_files.php | 2 +- phpBB/phpbb/language/language.php | 4 +- phpBB/phpbb/language/language_file_loader.php | 2 +- phpBB/phpbb/log/log.php | 12 +-- phpBB/phpbb/message/form.php | 4 +- phpBB/phpbb/message/message.php | 6 +- phpBB/phpbb/module/module_manager.php | 10 +-- phpBB/phpbb/notification/manager.php | 2 +- phpBB/phpbb/notification/type/pm.php | 2 +- phpBB/phpbb/notification/type/post.php | 10 +-- phpBB/phpbb/notification/type/topic.php | 2 +- phpBB/phpbb/profilefields/manager.php | 10 +-- phpBB/phpbb/profilefields/type/type_bool.php | 2 +- .../profilefields/type/type_dropdown.php | 6 +- phpBB/phpbb/report/controller/report.php | 6 +- phpBB/phpbb/search/base.php | 10 +-- phpBB/phpbb/search/fulltext_mysql.php | 22 ++--- phpBB/phpbb/search/fulltext_native.php | 48 +++++------ phpBB/phpbb/search/fulltext_postgres.php | 14 ++-- phpBB/phpbb/search/fulltext_sphinx.php | 10 +-- phpBB/phpbb/search/sphinx/config.php | 4 +- phpBB/phpbb/search/sphinx/config_section.php | 6 +- phpBB/phpbb/template/twig/extension.php | 2 +- phpBB/phpbb/tree/nestedset.php | 4 +- phpBB/phpbb/user_loader.php | 2 +- phpBB/posting.php | 30 +++---- phpBB/search.php | 40 ++++----- phpBB/viewforum.php | 24 +++--- phpBB/viewtopic.php | 48 +++++------ tests/cache/cache_memory_test.php | 2 +- tests/cron/manager_test.php | 2 +- tests/dbal/write_test.php | 2 +- tests/event/md_exporter_test.php | 4 +- tests/functional/fileupload_remote_test.php | 4 +- tests/functions/get_remote_file_test.php | 2 +- tests/mock/sql_insert_buffer.php | 2 +- tests/notification/base.php | 2 +- .../phpbb_database_test_case.php | 2 +- ...phpbb_database_test_connection_manager.php | 2 +- .../phpbb_functional_test_case.php | 4 +- tests/test_framework/phpbb_ui_test_case.php | 2 +- tests/upload/fileupload_test.php | 12 +-- tests/wrapper/version_compare_test.php | 2 +- 165 files changed, 986 insertions(+), 986 deletions(-) diff --git a/build/build_helper.php b/build/build_helper.php index 3ff1b89eab..ff93c22a12 100644 --- a/build/build_helper.php +++ b/build/build_helper.php @@ -39,8 +39,8 @@ class build_package $this->verbose = $verbose; // Get last two entries - $_latest = $this->versions[sizeof($this->versions) - 1]; - $_before = $this->versions[sizeof($this->versions) - 2]; + $_latest = $this->versions[count($this->versions) - 1]; + $_before = $this->versions[count($this->versions) - 2]; $this->locations = array( 'new_version' => dirname(dirname(__FILE__)) . '/phpBB/', diff --git a/build/package.php b/build/package.php index 178a27faad..18798d0602 100755 --- a/build/package.php +++ b/build/package.php @@ -33,7 +33,7 @@ echo "Now all three package types (patch, files, release) are built as well as t // Go trough all versions making a diff if we even have old versions // For phpBB 3.0.x we might choose a different update method, rendering the things below useless... -if (sizeof($package->old_packages)) +if (count($package->old_packages)) { chdir($package->locations['old_versions']); @@ -76,7 +76,7 @@ if (sizeof($package->old_packages)) // Create Directories along the way? $file = explode('/', $file); // Remove filename portion - $file[sizeof($file)-1] = ''; + $file[count($file)-1] = ''; chdir($dest_filename_dir); foreach ($file as $entry) @@ -169,7 +169,7 @@ if (sizeof($package->old_packages)) // Create Directories along the way? $file = explode('/', $file); // Remove filename portion - $file[sizeof($file)-1] = ''; + $file[count($file)-1] = ''; chdir($dest_filename_dir . '/install/update/old'); foreach ($file as $entry) @@ -214,7 +214,7 @@ if (sizeof($package->old_packages)) // Create Directories along the way? $file = explode('/', $file); // Remove filename portion - $file[sizeof($file)-1] = ''; + $file[count($file)-1] = ''; chdir($dest_filename_dir . '/install/update/new'); foreach ($file as $entry) @@ -321,7 +321,7 @@ $update_info = array( \'version\' => array(\'from\' => \'' . str_replace('_to_', '', $package->old_packages[$_package_name]) . '\', \'to\' => \'' . $package->get('new_version_number') . '\'), '; - if (sizeof($file_contents['all'])) + if (count($file_contents['all'])) { $index_contents .= "\t'files' => array(\n\t\t'" . implode("',\n\t\t'", $file_contents['all']) . "',\n\t),\n"; } @@ -330,7 +330,7 @@ $update_info = array( $index_contents .= "\t'files' => array(),\n"; } - if (sizeof($file_contents['binary'])) + if (count($file_contents['binary'])) { $index_contents .= "\t'binary' => array(\n\t\t'" . implode("',\n\t\t'", $file_contents['binary']) . "',\n\t),\n"; } @@ -339,7 +339,7 @@ $update_info = array( $index_contents .= "\t'binary' => array(),\n"; } - if (sizeof($file_contents['deleted'])) + if (count($file_contents['deleted'])) { $index_contents .= "\t'deleted' => array(\n\t\t'" . implode("',\n\t\t'", $file_contents['deleted']) . "',\n\t),\n"; } @@ -380,7 +380,7 @@ $compress_programs = array( 'zip' => 'zip -r' ); -if (sizeof($package->old_packages)) +if (count($package->old_packages)) { // Build Patch Files chdir($package->get('patch_directory')); diff --git a/phpBB/develop/add_permissions.php b/phpBB/develop/add_permissions.php index c575729d91..d7308a1acc 100644 --- a/phpBB/develop/add_permissions.php +++ b/phpBB/develop/add_permissions.php @@ -185,7 +185,7 @@ while ($row = $db->sql_fetchrow($result)) } $db->sql_freeresult($result); -if (sizeof($remove_auth_options)) +if (count($remove_auth_options)) { $db->sql_query('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')'); $db->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id IN (' . implode(', ', $remove_auth_options) . ')'); @@ -199,7 +199,7 @@ $prefixes = array('f_', 'a_', 'm_', 'u_'); foreach ($prefixes as $prefix) { $var = $prefix . 'permissions'; - if (sizeof(${$var})) + if (count(${$var})) { foreach (${$var} as $auth_option => $l_ary) { diff --git a/phpBB/develop/check_flash_bbcodes.php b/phpBB/develop/check_flash_bbcodes.php index 5dc112bfc0..282adad229 100644 --- a/phpBB/develop/check_flash_bbcodes.php +++ b/phpBB/develop/check_flash_bbcodes.php @@ -51,7 +51,7 @@ function check_table_flash_bbcodes($table_name, $id_field, $content_field, $uid_ $ids = get_table_flash_bbcode_pkids($table_name, $id_field, $content_field, $uid_field, $bitfield_field); - $size = sizeof($ids); + $size = count($ids); if ($size) { echo "Found $size potentially dangerous flash bbcodes.\n"; diff --git a/phpBB/develop/create_variable_overview.php b/phpBB/develop/create_variable_overview.php index ace2e4d953..da9a4fe683 100644 --- a/phpBB/develop/create_variable_overview.php +++ b/phpBB/develop/create_variable_overview.php @@ -489,12 +489,12 @@ foreach ($lang_references as $lang_var => $filenames) $html_data .= '' . $lang_var . '