From 07c6e821d56ec21fccfff2bba7d95285396fddc3 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 27 Jun 2017 23:27:13 +0700 Subject: [PATCH 01/11] [ticket/14972] Bump PHP requirements to 5.6. Update dependencies. Also bump to PHP 7.2 compatible versions: PHPUnit to 5.7, Guzzle to 6.3. PHPBB3-14972 --- phpBB/composer.json | 8 +- phpBB/composer.lock | 606 +++++++++++++++++++++++++++++--------------- 2 files changed, 411 insertions(+), 203 deletions(-) diff --git a/phpBB/composer.json b/phpBB/composer.json index 029fa70617..9f9ae38ffc 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -25,11 +25,11 @@ "phpbb/phpbb-core": "self.version" }, "require": { - "php": ">=5.5.9", + "php": ">=5.6", "bantu/ini-get-wrapper": "1.0.*", "composer/composer": "^1.0", "google/recaptcha": "~1.1", - "guzzlehttp/guzzle": "~6.2", + "guzzlehttp/guzzle": "~6.3", "lusitanian/oauth": "^0.8.1", "marc1706/fast-image-size": "^1.1", "paragonie/random_compat": "^1.4", @@ -56,7 +56,7 @@ "laravel/homestead": "~4.0", "phing/phing": "2.4.*", "phpunit/dbunit": "~2.0", - "phpunit/phpunit": "^4.1", + "phpunit/phpunit": "^5.7", "squizlabs/php_codesniffer": "2.*", "symfony/browser-kit": "~3.1", "symfony/css-selector": "~3.1", @@ -69,7 +69,7 @@ }, "config": { "platform": { - "php": "5.5.9" + "php": "5.6" } } } diff --git a/phpBB/composer.lock b/phpBB/composer.lock index 6f157469ca..facb52b971 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "f5d51665f9c854a0c1a107d79aa15b43", - "content-hash": "618aef0f9f23f2601a3cf0cb941c6d98", + "hash": "61013eb8f75bb8cf84d81f3f5603bae8", + "content-hash": "a604bdeaacd70e70afd1e06528649cd7", "packages": [ { "name": "bantu/ini-get-wrapper", @@ -343,16 +343,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.2.3", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006" + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", "shasum": "" }, "require": { @@ -362,9 +362,12 @@ }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0", + "phpunit/phpunit": "^4.0 || ^5.0", "psr/log": "^1.0" }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, "type": "library", "extra": { "branch-alias": { @@ -401,7 +404,7 @@ "rest", "web service" ], - "time": "2017-02-28 22:50:30" + "time": "2017-06-22 18:50:49" }, { "name": "guzzlehttp/promises", @@ -1135,16 +1138,16 @@ }, { "name": "seld/jsonlint", - "version": "1.6.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "791f8c594f300d246cdf01c6b3e1e19611e301d8" + "reference": "50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/791f8c594f300d246cdf01c6b3e1e19611e301d8", - "reference": "791f8c594f300d246cdf01c6b3e1e19611e301d8", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77", + "reference": "50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77", "shasum": "" }, "require": { @@ -1180,7 +1183,7 @@ "parser", "validator" ], - "time": "2017-03-06 16:42:24" + "time": "2017-06-18 15:11:04" }, { "name": "seld/phar-utils", @@ -1228,16 +1231,16 @@ }, { "name": "symfony/config", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "35716d4904e0506a7a5a9bcf23f854aeb5719bca" + "reference": "a094618deb9a3fe1c3cf500a796e167d0495a274" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/35716d4904e0506a7a5a9bcf23f854aeb5719bca", - "reference": "35716d4904e0506a7a5a9bcf23f854aeb5719bca", + "url": "https://api.github.com/repos/symfony/config/zipball/a094618deb9a3fe1c3cf500a796e167d0495a274", + "reference": "a094618deb9a3fe1c3cf500a796e167d0495a274", "shasum": "" }, "require": { @@ -1245,10 +1248,12 @@ "symfony/filesystem": "~2.8|~3.0" }, "conflict": { - "symfony/dependency-injection": "<3.3" + "symfony/dependency-injection": "<3.3", + "symfony/finder": "<3.3" }, "require-dev": { "symfony/dependency-injection": "~3.3", + "symfony/finder": "~3.3", "symfony/yaml": "~3.0" }, "suggest": { @@ -1284,20 +1289,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-06-02 18:07:20" + "time": "2017-06-16 12:40:34" }, { "name": "symfony/console", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "70d2a29b2911cbdc91a7e268046c395278238b2e" + "reference": "a97e45d98c59510f085fa05225a1acb74dfe0546" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/70d2a29b2911cbdc91a7e268046c395278238b2e", - "reference": "70d2a29b2911cbdc91a7e268046c395278238b2e", + "url": "https://api.github.com/repos/symfony/console/zipball/a97e45d98c59510f085fa05225a1acb74dfe0546", + "reference": "a97e45d98c59510f085fa05225a1acb74dfe0546", "shasum": "" }, "require": { @@ -1353,20 +1358,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-06-02 19:24:58" + "time": "2017-07-03 13:19:36" }, { "name": "symfony/debug", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "e9c50482841ef696e8fa1470d950a79c8921f45d" + "reference": "63b85a968486d95ff9542228dc2e4247f16f9743" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/e9c50482841ef696e8fa1470d950a79c8921f45d", - "reference": "e9c50482841ef696e8fa1470d950a79c8921f45d", + "url": "https://api.github.com/repos/symfony/debug/zipball/63b85a968486d95ff9542228dc2e4247f16f9743", + "reference": "63b85a968486d95ff9542228dc2e4247f16f9743", "shasum": "" }, "require": { @@ -1409,20 +1414,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-06-01 21:01:25" + "time": "2017-07-05 13:02:37" }, { "name": "symfony/dependency-injection", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "4cec19ec1d25f22e1ec8ab14635d3879a1287053" + "reference": "986a633c92220ecb22ad06820a1df126c7a4f9eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/4cec19ec1d25f22e1ec8ab14635d3879a1287053", - "reference": "4cec19ec1d25f22e1ec8ab14635d3879a1287053", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/986a633c92220ecb22ad06820a1df126c7a4f9eb", + "reference": "986a633c92220ecb22ad06820a1df126c7a4f9eb", "shasum": "" }, "require": { @@ -1479,20 +1484,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-06-06 03:13:52" + "time": "2017-06-20 14:01:46" }, { "name": "symfony/event-dispatcher", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "4054a102470665451108f9b59305c79176ef98f0" + "reference": "67535f1e3fd662bdc68d7ba317c93eecd973617e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4054a102470665451108f9b59305c79176ef98f0", - "reference": "4054a102470665451108f9b59305c79176ef98f0", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/67535f1e3fd662bdc68d7ba317c93eecd973617e", + "reference": "67535f1e3fd662bdc68d7ba317c93eecd973617e", "shasum": "" }, "require": { @@ -1542,20 +1547,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-06-04 18:15:29" + "time": "2017-06-09 14:53:08" }, { "name": "symfony/filesystem", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "c709670bf64721202ddbe4162846f250735842c0" + "reference": "311fa718389efbd8b627c272b9324a62437018cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/c709670bf64721202ddbe4162846f250735842c0", - "reference": "c709670bf64721202ddbe4162846f250735842c0", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/311fa718389efbd8b627c272b9324a62437018cc", + "reference": "311fa718389efbd8b627c272b9324a62437018cc", "shasum": "" }, "require": { @@ -1591,11 +1596,11 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-05-28 14:08:56" + "time": "2017-06-24 09:29:48" }, { "name": "symfony/finder", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -1644,16 +1649,16 @@ }, { "name": "symfony/http-foundation", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "80eb5a1f968448b77da9e8b2c0827f6e8d767846" + "reference": "f347a5f561b03db95ed666959db42bbbf429b7e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/80eb5a1f968448b77da9e8b2c0827f6e8d767846", - "reference": "80eb5a1f968448b77da9e8b2c0827f6e8d767846", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/f347a5f561b03db95ed666959db42bbbf429b7e5", + "reference": "f347a5f561b03db95ed666959db42bbbf429b7e5", "shasum": "" }, "require": { @@ -1693,20 +1698,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2017-06-05 13:06:51" + "time": "2017-06-24 09:29:48" }, { "name": "symfony/http-kernel", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "be8280f7fa8e95b86514f1e1be997668a53b2888" + "reference": "33f87c957122cfbd9d90de48698ee074b71106ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/be8280f7fa8e95b86514f1e1be997668a53b2888", - "reference": "be8280f7fa8e95b86514f1e1be997668a53b2888", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/33f87c957122cfbd9d90de48698ee074b71106ea", + "reference": "33f87c957122cfbd9d90de48698ee074b71106ea", "shasum": "" }, "require": { @@ -1779,7 +1784,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2017-06-06 03:59:58" + "time": "2017-07-05 13:28:15" }, { "name": "symfony/polyfill-mbstring", @@ -1842,16 +1847,16 @@ }, { "name": "symfony/process", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "8e30690c67aafb6c7992d6d8eb0d707807dd3eaf" + "reference": "5ab8949b682b1bf9d4511a228b5e045c96758c30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/8e30690c67aafb6c7992d6d8eb0d707807dd3eaf", - "reference": "8e30690c67aafb6c7992d6d8eb0d707807dd3eaf", + "url": "https://api.github.com/repos/symfony/process/zipball/5ab8949b682b1bf9d4511a228b5e045c96758c30", + "reference": "5ab8949b682b1bf9d4511a228b5e045c96758c30", "shasum": "" }, "require": { @@ -1887,11 +1892,11 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-05-22 12:32:03" + "time": "2017-07-03 08:12:02" }, { "name": "symfony/proxy-manager-bridge", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/proxy-manager-bridge.git", @@ -1945,16 +1950,16 @@ }, { "name": "symfony/routing", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "39804eeafea5cca851946e1eed122eb94459fdb4" + "reference": "dc70bbd0ca7b19259f63cdacc8af370bc32a4728" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/39804eeafea5cca851946e1eed122eb94459fdb4", - "reference": "39804eeafea5cca851946e1eed122eb94459fdb4", + "url": "https://api.github.com/repos/symfony/routing/zipball/dc70bbd0ca7b19259f63cdacc8af370bc32a4728", + "reference": "dc70bbd0ca7b19259f63cdacc8af370bc32a4728", "shasum": "" }, "require": { @@ -2019,33 +2024,36 @@ "uri", "url" ], - "time": "2017-06-02 09:51:43" + "time": "2017-06-24 09:29:48" }, { "name": "symfony/twig-bridge", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "7f1bc6676396441dc938dc4dacb49ae91f56b930" + "reference": "12829fa877910ee3fa4c71279e5d6a358e4b1d9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/7f1bc6676396441dc938dc4dacb49ae91f56b930", - "reference": "7f1bc6676396441dc938dc4dacb49ae91f56b930", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/12829fa877910ee3fa4c71279e5d6a358e4b1d9e", + "reference": "12829fa877910ee3fa4c71279e5d6a358e4b1d9e", "shasum": "" }, "require": { "php": ">=5.5.9", "twig/twig": "~1.34|~2.4" }, + "conflict": { + "symfony/form": "<3.2.10|~3.3,<3.3.3" + }, "require-dev": { "fig/link-util": "^1.0", "symfony/asset": "~2.8|~3.0", "symfony/console": "~2.8|~3.0", "symfony/expression-language": "~2.8|~3.0", "symfony/finder": "~2.8|~3.0", - "symfony/form": "^3.2.7", + "symfony/form": "^3.2.10|^3.3.3", "symfony/http-kernel": "~3.2", "symfony/polyfill-intl-icu": "~1.0", "symfony/routing": "~2.8|~3.0", @@ -2103,20 +2111,20 @@ ], "description": "Symfony Twig Bridge", "homepage": "https://symfony.com", - "time": "2017-06-06 03:13:52" + "time": "2017-06-24 09:29:48" }, { "name": "symfony/yaml", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "9752a30000a8ca9f4b34b5227d15d0101b96b063" + "reference": "1f93a8d19b8241617f5074a123e282575b821df8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/9752a30000a8ca9f4b34b5227d15d0101b96b063", - "reference": "9752a30000a8ca9f4b34b5227d15d0101b96b063", + "url": "https://api.github.com/repos/symfony/yaml/zipball/1f93a8d19b8241617f5074a123e282575b821df8", + "reference": "1f93a8d19b8241617f5074a123e282575b821df8", "shasum": "" }, "require": { @@ -2158,20 +2166,20 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-06-02 22:05:06" + "time": "2017-06-15 12:58:50" }, { "name": "twig/twig", - "version": "v1.34.3", + "version": "v1.34.4", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "451c6f4197e113e24c1c85bc3fc8c2d77adeff2e" + "reference": "f878bab48edb66ad9c6ed626bf817f60c6c096ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/451c6f4197e113e24c1c85bc3fc8c2d77adeff2e", - "reference": "451c6f4197e113e24c1c85bc3fc8c2d77adeff2e", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/f878bab48edb66ad9c6ed626bf817f60c6c096ee", + "reference": "f878bab48edb66ad9c6ed626bf817f60c6c096ee", "shasum": "" }, "require": { @@ -2223,7 +2231,7 @@ "keywords": [ "templating" ], - "time": "2017-06-07 18:45:17" + "time": "2017-07-04 13:19:31" }, { "name": "zendframework/zend-code", @@ -2279,26 +2287,26 @@ }, { "name": "zendframework/zend-eventmanager", - "version": "3.0.1", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-eventmanager.git", - "reference": "5c80bdee0e952be112dcec0968bad770082c3a6e" + "reference": "9d72db10ceb6e42fb92350c0cb54460da61bd79c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/5c80bdee0e952be112dcec0968bad770082c3a6e", - "reference": "5c80bdee0e952be112dcec0968bad770082c3a6e", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/9d72db10ceb6e42fb92350c0cb54460da61bd79c", + "reference": "9d72db10ceb6e42fb92350c0cb54460da61bd79c", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0" + "php": "^5.6 || ^7.0" }, "require-dev": { "athletic/athletic": "^0.1", "container-interop/container-interop": "^1.1.0", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "^2.0", + "phpunit/phpunit": "^6.0.7 || ^5.7.14", + "zendframework/zend-coding-standard": "~1.0.0", "zendframework/zend-stdlib": "^2.7.3 || ^3.0" }, "suggest": { @@ -2308,8 +2316,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev", - "dev-develop": "3.1-dev" + "dev-master": "3.2-dev", + "dev-develop": "3.3-dev" } }, "autoload": { @@ -2329,7 +2337,7 @@ "events", "zf2" ], - "time": "2016-02-18 20:53:00" + "time": "2017-07-11 19:17:22" } ], "packages-dev": [ @@ -2438,34 +2446,37 @@ }, { "name": "facebook/webdriver", - "version": "1.3.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/facebook/php-webdriver.git", - "reference": "77300c4ab2025d4316635f592ec849ca7323bd8c" + "reference": "eadb0b7a7c3e6578185197fd40158b08c3164c83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/77300c4ab2025d4316635f592ec849ca7323bd8c", - "reference": "77300c4ab2025d4316635f592ec849ca7323bd8c", + "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/eadb0b7a7c3e6578185197fd40158b08c3164c83", + "reference": "eadb0b7a7c3e6578185197fd40158b08c3164c83", "shasum": "" }, "require": { "ext-curl": "*", + "ext-zip": "*", "php": "^5.5 || ~7.0", "symfony/process": "^2.8 || ^3.1" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^1.11", + "friendsofphp/php-cs-fixer": "^2.0", "php-mock/php-mock-phpunit": "^1.1", "phpunit/phpunit": "4.6.* || ~5.0", "satooshi/php-coveralls": "^1.0", "squizlabs/php_codesniffer": "^2.6" }, - "suggest": { - "phpdocumentor/phpdocumentor": "2.*" - }, "type": "library", + "extra": { + "branch-alias": { + "dev-community": "1.5-dev" + } + }, "autoload": { "psr-4": { "Facebook\\WebDriver\\": "lib/" @@ -2475,7 +2486,7 @@ "license": [ "Apache-2.0" ], - "description": "A PHP client for WebDriver", + "description": "A PHP client for Selenium WebDriver", "homepage": "https://github.com/facebook/php-webdriver", "keywords": [ "facebook", @@ -2483,7 +2494,7 @@ "selenium", "webdriver" ], - "time": "2017-01-13 15:48:08" + "time": "2017-04-28 14:54:49" }, { "name": "laravel/homestead", @@ -2531,6 +2542,48 @@ "description": "A virtual machine for web artisans.", "time": "2017-02-07 19:06:26" }, + { + "name": "myclabs/deep-copy", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-04-12 18:52:22" + }, { "name": "phing/phing", "version": "2.4.14", @@ -2639,22 +2692,22 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + "reference": "46f7e8bb075036c92695b15a1ddb6971c751e585" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/46f7e8bb075036c92695b15a1ddb6971c751e585", + "reference": "46f7e8bb075036c92695b15a1ddb6971c751e585", "shasum": "" }, "require": { "php": ">=5.5", "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", + "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { @@ -2680,24 +2733,24 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30 07:12:33" + "time": "2017-07-15 11:38:20" }, { "name": "phpdocumentor/type-resolver", - "version": "0.2.1", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", "shasum": "" }, "require": { - "php": ">=5.5", + "php": "^5.5 || ^7.0", "phpdocumentor/reflection-common": "^1.0" }, "require-dev": { @@ -2727,7 +2780,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-11-25 06:54:22" + "time": "2017-07-14 14:27:02" }, { "name": "phpspec/prophecy", @@ -2849,39 +2902,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.2.4", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", "shasum": "" }, "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^5.6 || ^7.0", + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", + "phpunit/php-token-stream": "^1.4.2 || ^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0", + "sebastian/environment": "^1.3.2 || ^2.0", + "sebastian/version": "^1.0 || ^2.0" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" + "ext-xdebug": "^2.1.4", + "phpunit/phpunit": "^5.7" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" + "ext-xdebug": "^2.5.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -2907,7 +2961,7 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2017-04-02 07:44:40" }, { "name": "phpunit/php-file-iterator", @@ -3097,40 +3151,50 @@ }, { "name": "phpunit/phpunit", - "version": "4.8.35", + "version": "5.7.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87" + "reference": "3b91adfb64264ddec5a2dee9851f354aa66327db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/791b1a67c25af50e230f841ee7a9c6eba507dc87", - "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3b91adfb64264ddec5a2dee9851f354aa66327db", + "reference": "3b91adfb64264ddec5a2dee9851f354aa66327db", "shasum": "" }, "require": { "ext-dom": "*", "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "~1.3", + "php": "^5.6 || ^7.0", + "phpspec/prophecy": "^1.6.2", + "phpunit/php-code-coverage": "^4.0.4", "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", + "phpunit/phpunit-mock-objects": "^3.2", + "sebastian/comparator": "^1.2.4", + "sebastian/diff": "^1.4.3", + "sebastian/environment": "^1.3.4 || ^2.0", + "sebastian/exporter": "~2.0", + "sebastian/global-state": "^1.1", + "sebastian/object-enumerator": "~2.0", + "sebastian/resource-operations": "~1.0", + "sebastian/version": "~1.0.3|~2.0", "symfony/yaml": "~2.1|~3.0" }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2" + }, + "require-dev": { + "ext-pdo": "*" + }, "suggest": { + "ext-xdebug": "*", "phpunit/php-invoker": "~1.1" }, "bin": [ @@ -3139,7 +3203,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.8.x-dev" + "dev-master": "5.7.x-dev" } }, "autoload": { @@ -3165,30 +3229,33 @@ "testing", "xunit" ], - "time": "2017-02-06 05:18:07" + "time": "2017-06-21 08:11:54" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", + "version": "3.4.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", + "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "php": "^5.6 || ^7.0", + "phpunit/php-text-template": "^1.2", + "sebastian/exporter": "^1.2 || ^2.0" + }, + "conflict": { + "phpunit/phpunit": "<5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^5.4" }, "suggest": { "ext-soap": "*" @@ -3196,7 +3263,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "3.2.x-dev" } }, "autoload": { @@ -3221,7 +3288,52 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2017-06-30 09:13:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04 06:30:41" }, { "name": "sebastian/comparator", @@ -3341,28 +3453,28 @@ }, { "name": "sebastian/environment", - "version": "1.3.8", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" + "phpunit/phpunit": "^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -3387,25 +3499,25 @@ "environment", "hhvm" ], - "time": "2016-08-18 05:49:44" + "time": "2016-11-26 07:53:53" }, { "name": "sebastian/exporter", - "version": "1.2.2", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", "shasum": "" }, "require": { "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" + "sebastian/recursion-context": "~2.0" }, "require-dev": { "ext-mbstring": "*", @@ -3414,7 +3526,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -3454,7 +3566,7 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "time": "2016-11-19 08:54:04" }, { "name": "sebastian/global-state", @@ -3508,17 +3620,63 @@ "time": "2015-10-12 03:26:01" }, { - "name": "sebastian/recursion-context", - "version": "1.0.5", + "name": "sebastian/object-enumerator", + "version": "2.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sebastian/recursion-context": "~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-02-18 15:18:39" + }, + { + "name": "sebastian/recursion-context", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", "shasum": "" }, "require": { @@ -3530,7 +3688,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -3558,23 +3716,73 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03 07:41:43" + "time": "2016-11-19 07:33:16" }, { - "name": "sebastian/version", - "version": "1.0.6", + "name": "sebastian/resource-operations", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", "shasum": "" }, + "require": { + "php": ">=5.6.0" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28 20:34:47" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -3593,7 +3801,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2016-10-03 07:35:21" }, { "name": "squizlabs/php_codesniffer", @@ -3675,16 +3883,16 @@ }, { "name": "symfony/browser-kit", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "c2c8ceb1aa9dab9eae54e9150e6a588ce3e53be1" + "reference": "3a4435e79a8401746e8525e98039199d0924b4e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/c2c8ceb1aa9dab9eae54e9150e6a588ce3e53be1", - "reference": "c2c8ceb1aa9dab9eae54e9150e6a588ce3e53be1", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/3a4435e79a8401746e8525e98039199d0924b4e5", + "reference": "3a4435e79a8401746e8525e98039199d0924b4e5", "shasum": "" }, "require": { @@ -3728,11 +3936,11 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:14:56" + "time": "2017-06-24 09:29:48" }, { "name": "symfony/css-selector", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -3785,7 +3993,7 @@ }, { "name": "symfony/dom-crawler", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", @@ -3896,10 +4104,10 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.5.9" + "php": ">=5.6" }, "platform-dev": [], "platform-overrides": { - "php": "5.5.9" + "php": "5.6" } } From 055a5f80400b5e1df63f5f123053574843aff233 Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 9 Jan 2017 00:23:08 +0700 Subject: [PATCH 02/11] [ticket/14972] Fix sizeof calls As of PHP 7.2, only arrays and objects implementing the Countable interface should be passed as a count() or sizeof() parameter. See https://github.com/php/php-src/blob/php-7.2.0alpha2/UPGRADING#L197-L198 Also, sizeof() seems to be sheduled for deprecation, see https://wiki.php.net/rfc/deprecations_php_7_2#suggested_deprecations PHPBB3-14972 --- phpBB/includes/functions.php | 30 +++++----- phpBB/includes/functions_admin.php | 92 +++++++++++++++--------------- phpBB/includes/functions_user.php | 68 +++++++++++----------- phpBB/phpbb/db/driver/driver.php | 19 +++--- phpBB/phpbb/session.php | 20 +++---- 5 files changed, 113 insertions(+), 116 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 31b517eb84..248adb2b7c 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -590,7 +590,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ if ($mode == 'all') { - if ($forum_id === false || !sizeof($forum_id)) + if (empty($forum_id)) { // Mark all forums read (index page) /* @var $phpbb_notifications \phpbb\notification\manager */ @@ -715,7 +715,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } $db->sql_freeresult($result); - if (sizeof($sql_update)) + if (count($sql_update)) { $sql = 'UPDATE ' . FORUMS_TRACK_TABLE . " SET mark_time = $post_time @@ -851,7 +851,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ // We get the ten most minimum stored time offsets and its associated topic ids $time_keys = array(); - for ($i = 0; $i < 10 && sizeof($tracking['t']); $i++) + for ($i = 0; $i < 10 && count($tracking['t']); $i++) { $min_value = min($tracking['t']); $m_tkey = array_search($min_value, $tracking['t']); @@ -947,7 +947,7 @@ function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $ $topic_ids = array_diff($topic_ids, array_keys($last_read)); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $mark_time = array(); @@ -999,7 +999,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis $topic_ids = array_diff($topic_ids, array_keys($last_read)); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql = 'SELECT forum_id, mark_time FROM ' . FORUMS_TRACK_TABLE . " @@ -1026,7 +1026,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis { global $tracking_topics; - if (!isset($tracking_topics) || !sizeof($tracking_topics)) + if (!isset($tracking_topics) || !count($tracking_topics)) { $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); @@ -1053,7 +1053,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis $topic_ids = array_diff($topic_ids, array_keys($last_read)); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $mark_time = array(); @@ -1395,7 +1395,7 @@ function tracking_unserialize($string, $max_depth = 3) switch ($string[$i]) { case '(': - if (sizeof($stack) >= $max_depth) + if (count($stack) >= $max_depth) { die('Invalid data supplied'); } @@ -1449,7 +1449,7 @@ function tracking_unserialize($string, $max_depth = 3) } } - if (sizeof($stack) != 0 || ($mode != 0 && $mode != 3)) + if (count($stack) != 0 || ($mode != 0 && $mode != 3)) { die('Invalid data supplied'); } @@ -2663,9 +2663,9 @@ function parse_cfg_file($filename, $lines = false) { $value = ''; } - else if (($value[0] == "'" && $value[sizeof($value) - 1] == "'") || ($value[0] == '"' && $value[sizeof($value) - 1] == '"')) + else if (($value[0] == "'" && $value[strlen($value) - 1] == "'") || ($value[0] == '"' && $value[strlen($value) - 1] == '"')) { - $value = htmlspecialchars(substr($value, 1, sizeof($value)-2)); + $value = htmlspecialchars(substr($value, 1, strlen($value)-2)); } else { @@ -2994,7 +2994,7 @@ function phpbb_inet_pton($address) if (preg_match(get_preg_expression('ipv6'), $address)) { $parts = explode(':', $address); - $missing_parts = 8 - sizeof($parts) + 1; + $missing_parts = 8 - count($parts) + 1; if (substr($address, 0, 2) === '::') { @@ -3011,7 +3011,7 @@ function phpbb_inet_pton($address) if (preg_match(get_preg_expression('ipv4'), $last_part)) { - $parts[sizeof($parts) - 1] = ''; + $parts[count($parts) - 1] = ''; $last_part = phpbb_inet_pton($last_part); $embedded_ipv4 = true; --$missing_parts; @@ -3023,7 +3023,7 @@ function phpbb_inet_pton($address) { $ret .= str_pad($part, 4, '0', STR_PAD_LEFT); } - else if ($i && $i < sizeof($parts) - 1) + else if ($i && $i < count($parts) - 1) { $ret .= str_repeat('0000', $missing_parts); } @@ -3619,7 +3619,7 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum' // Need caps version of $item for language-strings $item_caps = strtoupper($item); - if (sizeof($online_users['online_users'])) + if (count($online_users['online_users'])) { $sql_ary = array( 'SELECT' => 'u.username, u.username_clean, u.user_id, u.user_type, u.user_allow_viewonline, u.user_colour', diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 929b7739a6..d62c7a21b3 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -167,7 +167,7 @@ function size_select_options($size_compare) $s_size_options = ''; - for ($i = 0, $size = sizeof($size_types_text); $i < $size; $i++) + for ($i = 0, $size = count($size_types_text); $i < $size; $i++) { $selected = ($size_compare == $size_types[$i]) ? ' selected="selected"' : ''; $s_size_options .= ''; @@ -192,7 +192,7 @@ function group_select_options($group_id, $exclude_ids = false, $manage_founder = /** @var \phpbb\group\helper $group_helper */ $group_helper = $phpbb_container->get('group_helper'); - $exclude_sql = ($exclude_ids !== false && sizeof($exclude_ids)) ? 'WHERE ' . $db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : ''; + $exclude_sql = ($exclude_ids !== false && count($exclude_ids)) ? 'WHERE ' . $db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : ''; $sql_and = (!$config['coppa_enable']) ? (($exclude_sql) ? ' AND ' : ' WHERE ') . "group_name <> 'REGISTERED_COPPA'" : ''; $sql_founder = ($manage_founder !== false) ? (($exclude_sql || $sql_and) ? ' AND ' : ' WHERE ') . 'group_founder_manage = ' . (int) $manage_founder : ''; @@ -747,7 +747,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s { $where_ids = (is_array($where_ids)) ? array_unique($where_ids) : array($where_ids); - if (!sizeof($where_ids)) + if (!count($where_ids)) { return array('topics' => 0, 'posts' => 0); } @@ -777,9 +777,9 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s } $db->sql_freeresult($result); - $return['topics'] = sizeof($topic_ids); + $return['topics'] = count($topic_ids); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { return $return; } @@ -837,7 +837,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s } $db->sql_freeresult($result); - if (sizeof($moved_topic_ids)) + if (count($moved_topic_ids)) { $sql = 'DELETE FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $moved_topic_ids); @@ -923,7 +923,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = $where_ids = array($where_ids); } - if (!sizeof($where_ids)) + if (!count($where_ids)) { return false; } @@ -974,7 +974,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } $db->sql_freeresult($result); - if (!sizeof($post_ids)) + if (!count($post_ids)) { return false; } @@ -1018,7 +1018,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = unset($table_ary); // Adjust users post counts - if (sizeof($post_counts) && $post_count_sync) + if (count($post_counts) && $post_count_sync) { foreach ($post_counts as $poster_id => $substract) { @@ -1037,7 +1037,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } // Remove topics now having no posts? - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql = 'SELECT topic_id FROM ' . POSTS_TABLE . ' @@ -1147,7 +1147,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } // We actually remove topics now to not be inconsistent (the delete_topics function calls this function too) - if (sizeof($remove_topics) && $call_delete_topics) + if (count($remove_topics) && $call_delete_topics) { delete_topics('topic_id', $remove_topics, $auto_sync, $post_count_sync, false); } @@ -1157,7 +1157,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = $phpbb_notifications->delete_notifications($delete_notifications_types, $post_ids); - return sizeof($post_ids); + return count($post_ids); } /** @@ -1210,7 +1210,7 @@ function delete_topic_shadows($forum_id, $sql_more = '', $auto_sync = true) $db->sql_query($sql); } } - while (sizeof($topic_ids) == $batch_size); + while (count($topic_ids) == $batch_size); if ($auto_sync) { @@ -1324,7 +1324,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, // Do not sync the "global forum" $where_ids = array_diff($where_ids, array(0)); - if (!sizeof($where_ids)) + if (!count($where_ids)) { // Empty array with IDs. This means that we don't have any work to do. Just return. return; @@ -1338,7 +1338,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } else { - if (!sizeof($where_ids)) + if (!count($where_ids)) { return; } @@ -1377,7 +1377,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } $db->sql_freeresult($result); - if (!sizeof($topic_id_ary)) + if (!count($topic_id_ary)) { return; } @@ -1494,7 +1494,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $post_ids[] = $post_id; } - if (sizeof($post_ids)) + if (count($post_ids)) { $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_reported = 1 - post_reported @@ -1540,7 +1540,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } $db->sql_freeresult($result); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_reported = 1 - topic_reported @@ -1599,7 +1599,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $post_ids[] = $post_id; } - if (sizeof($post_ids)) + if (count($post_ids)) { $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_attachment = 1 - post_attachment @@ -1645,7 +1645,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } $db->sql_freeresult($result); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_attachment = 1 - topic_attachment @@ -1697,7 +1697,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } $db->sql_freeresult($result); - if (!sizeof($forum_ids)) + if (!count($forum_ids)) { break; } @@ -1736,7 +1736,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, // 3: Get post count for each forum (optional) if ($sync_extra) { - if (sizeof($forum_ids) == 1) + if (count($forum_ids) == 1) { $sql = 'SELECT SUM(t.topic_posts_approved) AS forum_posts_approved, SUM(t.topic_posts_unapproved) AS forum_posts_unapproved, SUM(t.topic_posts_softdeleted) AS forum_posts_softdeleted FROM ' . TOPICS_TABLE . ' t @@ -1756,7 +1756,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, while ($row = $db->sql_fetchrow($result)) { - $forum_id = (sizeof($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; + $forum_id = (count($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; $forum_data[$forum_id]['posts_approved'] = (int) $row['forum_posts_approved']; $forum_data[$forum_id]['posts_unapproved'] = (int) $row['forum_posts_unapproved']; @@ -1766,7 +1766,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } // 4: Get last_post_id for each forum - if (sizeof($forum_ids) == 1) + if (count($forum_ids) == 1) { $sql = 'SELECT MAX(t.topic_last_post_id) as last_post_id FROM ' . TOPICS_TABLE . ' t @@ -1786,7 +1786,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, while ($row = $db->sql_fetchrow($result)) { - $forum_id = (sizeof($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; + $forum_id = (count($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; $forum_data[$forum_id]['last_post_id'] = (int) $row['last_post_id']; @@ -1795,7 +1795,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $db->sql_freeresult($result); // 5: Retrieve last_post infos - if (sizeof($post_ids)) + if (count($post_ids)) { $sql = 'SELECT p.post_id, p.poster_id, p.post_subject, p.post_time, p.post_username, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u @@ -1863,7 +1863,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } } - if (sizeof($sql_ary)) + if (count($sql_ary)) { $sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' @@ -1986,20 +1986,20 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } // Now we delete empty topics and orphan posts - if (sizeof($delete_posts)) + if (count($delete_posts)) { delete_posts('topic_id', array_keys($delete_posts), false); unset($delete_posts); } - if (!sizeof($topic_data)) + if (!count($topic_data)) { // If we get there, topic ids were invalid or topics did not contain any posts delete_topics($where_type, $where_ids, true); return; } - if (sizeof($delete_topics)) + if (count($delete_topics)) { $delete_topic_ids = array(); foreach ($delete_topics as $topic_id => $void) @@ -2042,7 +2042,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $db->sql_freeresult($result); // Make sure shadow topics do link to existing topics - if (sizeof($moved_topics)) + if (count($moved_topics)) { $delete_topics = array(); @@ -2059,7 +2059,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } $db->sql_freeresult($result); - if (sizeof($delete_topics)) + if (count($delete_topics)) { delete_topics('topic_id', $delete_topics, false); } @@ -2082,7 +2082,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $db->sql_freeresult($result); $sync_shadow_topics = array(); - if (sizeof($post_ids)) + if (count($post_ids)) { $sql = 'SELECT p.post_id, p.topic_id, p.post_visibility, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u @@ -2135,7 +2135,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $shadow_topic_data = array(); // Update the information we collected - if (sizeof($sync_shadow_topics)) + if (count($sync_shadow_topics)) { foreach ($sync_shadow_topics as $sync_topic_id => $sql_ary) { @@ -2200,7 +2200,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } } - if (sizeof($sql_ary)) + if (count($sql_ary)) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' @@ -2217,7 +2217,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, // if some topics have been resync'ed then resync parent forums // except when we're only syncing a range, we don't want to sync forums during // batch processing. - if ($resync_parents && sizeof($resync_forums) && $where_type != 'range') + if ($resync_parents && count($resync_forums) && $where_type != 'range') { sync('forum', 'forum_id', array_values($resync_forums), true, true); } @@ -2239,7 +2239,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync $forum_id = array($forum_id); } - if (!sizeof($forum_id)) + if (!count($forum_id)) { return; } @@ -2402,7 +2402,7 @@ function phpbb_cache_moderators($db, $cache, $auth) $hold_ary = $auth->acl_user_raw_data(false, 'm_%', false); // Add users? - if (sizeof($hold_ary)) + if (!empty($hold_ary)) { // At least one moderative option warrants a display $ug_id_ary = array_keys($hold_ary); @@ -2447,7 +2447,7 @@ function phpbb_cache_moderators($db, $cache, $auth) } $db->sql_freeresult($result); - if (sizeof($hold_ary)) + if (count($hold_ary)) { // Get usernames... $sql = 'SELECT user_id, username @@ -2487,7 +2487,7 @@ function phpbb_cache_moderators($db, $cache, $auth) // Now to the groups... $hold_ary = $auth->acl_group_raw_data(false, 'm_%', false); - if (sizeof($hold_ary)) + if (!empty($hold_ary)) { $ug_id_ary = array_keys($hold_ary); @@ -2591,7 +2591,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) { // update foes for some user - if (is_array($user_id) && sizeof($user_id)) + if (is_array($user_id) && count($user_id)) { $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' WHERE ' . $db->sql_in_set('zebra_id', $user_id) . ' @@ -2601,7 +2601,7 @@ function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) } // update foes for some group - if (is_array($group_id) && sizeof($group_id)) + if (is_array($group_id) && count($group_id)) { // Grab group settings... $sql_ary = array( @@ -2635,7 +2635,7 @@ function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) } $db->sql_freeresult($result); - if (!sizeof($groups)) + if (!count($groups)) { return; } @@ -2665,7 +2665,7 @@ function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) } $db->sql_freeresult($result); - if (sizeof($users)) + if (count($users)) { $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' WHERE ' . $db->sql_in_set('zebra_id', $users) . ' @@ -2688,7 +2688,7 @@ function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) } } - if (sizeof($perms)) + if (count($perms)) { $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' WHERE ' . $db->sql_in_set('zebra_id', array_unique($perms)) . ' @@ -2951,7 +2951,7 @@ function tidy_warnings() } $db->sql_freeresult($result); - if (sizeof($warning_list)) + if (count($warning_list)) { $db->sql_transaction('begin'); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 3dd4b3c2e5..f1e03869b4 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -170,7 +170,7 @@ function user_update_name($old_name, $new_name) * Adds an user * * @param mixed $user_row An array containing the following keys (and the appropriate values): username, group_id (the group to place the user in), user_email and the user_type(usually 0). Additional entries not overridden by defaults will be forwarded. -* @param string $cp_data custom profile fields, see custom_profile::build_insert_sql_array +* @param array $cp_data custom profile fields, see custom_profile::build_insert_sql_array * @param array $notifications_data The notifications settings for the new user * @return the new user's ID. */ @@ -260,7 +260,7 @@ function user_add($user_row, $cp_data = false, $notifications_data = null) $remaining_vars = array_diff(array_keys($user_row), array_keys($sql_ary)); // Now fill our sql array with the remaining vars - if (sizeof($remaining_vars)) + if (count($remaining_vars)) { foreach ($remaining_vars as $key) { @@ -289,7 +289,7 @@ function user_add($user_row, $cp_data = false, $notifications_data = null) $user_id = $db->sql_nextid(); // Insert Custom Profile Fields - if ($cp_data !== false && sizeof($cp_data)) + if ($cp_data !== false && count($cp_data)) { $cp_data['user_id'] = (int) $user_id; @@ -468,7 +468,7 @@ function user_delete($mode, $user_ids, $retain_username = true) } $db->sql_freeresult($result); - if (sizeof($report_posts)) + if (count($report_posts)) { $report_posts = array_unique($report_posts); $report_topics = array_unique($report_topics); @@ -488,7 +488,7 @@ function user_delete($mode, $user_ids, $retain_username = true) } $db->sql_freeresult($result); - if (sizeof($keep_report_topics)) + if (count($keep_report_topics)) { $report_topics = array_diff($report_topics, $keep_report_topics); } @@ -500,7 +500,7 @@ function user_delete($mode, $user_ids, $retain_username = true) WHERE ' . $db->sql_in_set('post_id', $report_posts); $db->sql_query($sql); - if (sizeof($report_topics)) + if (count($report_topics)) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_reported = 0 @@ -765,7 +765,7 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) $user_id_ary = array($user_id_ary); } - if (!sizeof($user_id_ary)) + if (!count($user_id_ary)) { return; } @@ -823,7 +823,7 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) $vars = array('mode', 'reason', 'activated', 'deactivated', 'user_id_ary', 'sql_statements'); extract($phpbb_dispatcher->trigger_event('core.user_active_flip_before', compact($vars))); - if (sizeof($sql_statements)) + if (count($sql_statements)) { foreach ($sql_statements as $user_id => $sql_ary) { @@ -901,7 +901,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas else { $ban_other = explode('-', $ban_len_other); - if (sizeof($ban_other) == 3 && ((int) $ban_other[0] < 9999) && + if (count($ban_other) == 3 && ((int) $ban_other[0] < 9999) && (strlen($ban_other[0]) == 4) && (strlen($ban_other[1]) == 2) && (strlen($ban_other[2]) == 2)) { $ban_end = max($current_time, $user->create_datetime() @@ -969,7 +969,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas } // Make sure we have been given someone to ban - if (!sizeof($sql_usernames)) + if (!count($sql_usernames)) { trigger_error('NO_USER_SPECIFIED', E_USER_WARNING); } @@ -980,7 +980,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas // Do not allow banning yourself, the guest account, or founders. $non_bannable = array($user->data['user_id'], ANONYMOUS); - if (sizeof($founder)) + if (count($founder)) { $sql .= ' AND ' . $db->sql_in_set('user_id', array_merge(array_keys($founder), $non_bannable), true); } @@ -1120,14 +1120,14 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas continue; } - if (!sizeof($founder) || !in_array($ban_item, $founder)) + if (!count($founder) || !in_array($ban_item, $founder)) { $banlist_ary[] = $ban_item; } } } - if (sizeof($ban_list) == 0) + if (count($ban_list) == 0) { trigger_error('NO_EMAILS_DEFINED', E_USER_WARNING); } @@ -1174,7 +1174,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas $banlist_ary_tmp = array_intersect($banlist_ary, $banlist_ary_tmp); - if (sizeof($banlist_ary_tmp)) + if (count($banlist_ary_tmp)) { // One or more entities are already banned/excluded, delete the existing bans, so they can be re-inserted with the given new length $sql = 'DELETE FROM ' . BANLIST_TABLE . ' @@ -1188,7 +1188,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas $db->sql_freeresult($result); // We have some entities to ban - if (sizeof($banlist_ary)) + if (count($banlist_ary)) { $sql_ary = array(); @@ -1316,7 +1316,7 @@ function user_unban($mode, $ban) $unban_sql = array_map('intval', $ban); - if (sizeof($unban_sql)) + if (count($unban_sql)) { // Grab details of bans for logging information later switch ($mode) @@ -1580,7 +1580,7 @@ function validate_num($num, $optional = false, $min = 0, $max = 1E99) function validate_date($date_string, $optional = false) { $date = explode('-', $date_string); - if ((empty($date) || sizeof($date) != 3) && $optional) + if ((empty($date) || count($date) != 3) && $optional) { return false; } @@ -1602,7 +1602,7 @@ function validate_date($date_string, $optional = false) } } - if (sizeof($date) != 3 || !checkdate($date[1], $date[0], $date[2])) + if (count($date) != 3 || !checkdate($date[1], $date[0], $date[2])) { return 'INVALID'; } @@ -1942,7 +1942,7 @@ function validate_jabber($jid) $arr = explode('.', $realm); - if (sizeof($arr) == 0) + if (count($arr) == 0) { return 'WRONG_DATA'; } @@ -2266,7 +2266,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow $group_teampage = !empty($group_attributes['group_teampage']); unset($group_attributes['group_teampage']); - if (!sizeof($error)) + if (!count($error)) { $current_legend = \phpbb\groupposition\legend::GROUP_DISABLED; $current_teampage = \phpbb\groupposition\teampage::GROUP_DISABLED; @@ -2339,7 +2339,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow generate_text_for_storage($sql_ary['group_desc'], $sql_ary['group_desc_uid'], $sql_ary['group_desc_bitfield'], $sql_ary['group_desc_options'], $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies); } - if (sizeof($group_attributes)) + if (count($group_attributes)) { // Merge them with $sql_ary to properly update the group $sql_ary = array_merge($sql_ary, $group_attributes); @@ -2465,7 +2465,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow // Set user attributes $sql_ary = array(); - if (sizeof($group_attributes)) + if (count($group_attributes)) { // Go through the user attributes array, check if a group attribute matches it and then set it. ;) foreach ($user_attribute_ary as $attribute) @@ -2485,7 +2485,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow } } - if (sizeof($sql_ary) && sizeof($user_ary)) + if (count($sql_ary) && count($user_ary)) { group_set_user_default($group_id, $user_ary, $sql_ary); } @@ -2496,7 +2496,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow group_update_listings($group_id); } - return (sizeof($error)) ? $error : false; + return (count($error)) ? $error : false; } @@ -2661,7 +2661,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); - if (!sizeof($user_id_ary) || $result !== false) + if (empty($user_id_ary) || $result !== false) { return 'NO_USER'; } @@ -2689,7 +2689,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $add_id_ary = array_diff($user_id_ary, $add_id_ary); // If we have no users - if (!sizeof($add_id_ary) && !sizeof($update_id_ary)) + if (!count($add_id_ary) && !count($update_id_ary)) { return 'GROUP_USERS_EXIST'; } @@ -2697,7 +2697,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $db->sql_transaction('begin'); // Insert the new users - if (sizeof($add_id_ary)) + if (count($add_id_ary)) { $sql_ary = array(); @@ -2714,7 +2714,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $db->sql_multi_insert(USER_GROUP_TABLE, $sql_ary); } - if (sizeof($update_id_ary)) + if (count($update_id_ary)) { $sql = 'UPDATE ' . USER_GROUP_TABLE . ' SET group_leader = 1 @@ -2806,7 +2806,7 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); - if (!sizeof($user_id_ary) || $result !== false) + if (empty($user_id_ary) || $result !== false) { return 'NO_USER'; } @@ -2882,7 +2882,7 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false, foreach ($special_group_data as $gid => $default_data_ary) { - if (isset($sql_where_ary[$gid]) && sizeof($sql_where_ary[$gid])) + if (isset($sql_where_ary[$gid]) && count($sql_where_ary[$gid])) { remove_default_rank($group_id, $sql_where_ary[$gid]); remove_default_avatar($group_id, $sql_where_ary[$gid]); @@ -3041,7 +3041,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna // We need both username and user_id info $result = user_get_id_name($user_id_ary, $username_ary); - if (!sizeof($user_id_ary) || $result !== false) + if (empty($user_id_ary) || $result !== false) { return 'NO_USERS'; } @@ -3096,7 +3096,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna } $db->sql_freeresult($result); - if (!sizeof($user_id_ary)) + if (!count($user_id_ary)) { return false; } @@ -3137,7 +3137,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna $db->sql_freeresult($result); $result = user_get_id_name($user_id_ary, $username_ary); - if (!sizeof($user_id_ary) || $result !== false) + if (!count($user_id_ary) || $result !== false) { return 'NO_USERS'; } @@ -3500,7 +3500,7 @@ function group_update_listings($group_id) $hold_ary = $auth->acl_group_raw_data($group_id, array('a_', 'm_')); - if (!sizeof($hold_ary)) + if (empty($hold_ary)) { return; } diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php index 214c5590e7..5851469806 100644 --- a/phpBB/phpbb/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php @@ -537,7 +537,9 @@ abstract class driver implements driver_interface */ function sql_in_set($field, $array, $negate = false, $allow_empty_set = false) { - if (!sizeof($array)) + $array = (array) $array; + + if (!count($array)) { if (!$allow_empty_set) { @@ -559,12 +561,7 @@ abstract class driver implements driver_interface } } - if (!is_array($array)) - { - $array = array($array); - } - - if (sizeof($array) == 1) + if (count($array) == 1) { @reset($array); $var = current($array); @@ -632,7 +629,7 @@ abstract class driver implements driver_interface */ function sql_multi_insert($table, $sql_ary) { - if (!sizeof($sql_ary)) + if (!count($sql_ary)) { return false; } @@ -738,7 +735,7 @@ abstract class driver implements driver_interface // We run the following code to determine if we need to re-order the table array. ;) // The reason for this is that for multi-aliased tables (two equal tables) in the FROM statement the last table need to match the first comparison. // DBMS who rely on this: Oracle, PostgreSQL and MSSQL. For all other DBMS it makes absolutely no difference in which order the table is. - if (!empty($array['LEFT_JOIN']) && sizeof($array['FROM']) > 1 && $used_multi_alias !== false) + if (!empty($array['LEFT_JOIN']) && count($array['FROM']) > 1 && $used_multi_alias !== false) { // Take first LEFT JOIN $join = current($array['LEFT_JOIN']); @@ -848,7 +845,7 @@ abstract class driver implements driver_interface default: - switch (sizeof($condition)) + switch (count($condition)) { case 3: @@ -1138,7 +1135,7 @@ abstract class driver implements driver_interface $html_table = func_get_arg(2); $row = func_get_arg(3); - if (!$html_table && sizeof($row)) + if (!$html_table && count($row)) { $html_table = true; $this->html_hold .= ''; diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index c5b50c2b07..68d36e5c57 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -99,7 +99,7 @@ class session $root_dirs = array_diff_assoc($root_dirs, $intersection); $page_dirs = array_diff_assoc($page_dirs, $intersection); - $page_dir = str_repeat('../', sizeof($root_dirs)) . implode('/', $page_dirs); + $page_dir = str_repeat('../', count($root_dirs)) . implode('/', $page_dirs); if ($page_dir && substr($page_dir, -1, 1) == '/') { @@ -118,8 +118,8 @@ class session // The script path from the webroot to the phpBB root (for example: /phpBB3/) $script_dirs = explode('/', $script_path); - array_splice($script_dirs, -sizeof($page_dirs)); - $root_script_path = implode('/', $script_dirs) . (sizeof($root_dirs) ? '/' . implode('/', $root_dirs) : ''); + array_splice($script_dirs, -count($page_dirs)); + $root_script_path = implode('/', $script_dirs) . (count($root_dirs) ? '/' . implode('/', $root_dirs) : ''); // We are on the base level (phpBB root == webroot), lets adjust the variables a bit... if (!$root_script_path) @@ -575,12 +575,12 @@ class session $provider = $provider_collection->get_provider(); $this->data = $provider->autologin(); - if ($user_id !== false && sizeof($this->data) && $this->data['user_id'] != $user_id) + if ($user_id !== false && isset($this->data['user_id']) && $this->data['user_id'] != $user_id) { $this->data = array(); } - if (sizeof($this->data)) + if (isset($this->data['user_id'])) { $this->cookie_data['k'] = ''; $this->cookie_data['u'] = $this->data['user_id']; @@ -588,7 +588,7 @@ class session // If we're presented with an autologin key we'll join against it. // Else if we've been passed a user_id we'll grab data based on that - if (isset($this->cookie_data['k']) && $this->cookie_data['k'] && $this->cookie_data['u'] && !sizeof($this->data)) + if (isset($this->cookie_data['k']) && $this->cookie_data['k'] && $this->cookie_data['u'] && empty($this->data)) { $sql = 'SELECT u.* FROM ' . USERS_TABLE . ' u, ' . SESSIONS_KEYS_TABLE . ' k @@ -608,7 +608,7 @@ class session $db->sql_freeresult($result); } - if ($user_id !== false && !sizeof($this->data)) + if ($user_id !== false && empty($this->data)) { $this->cookie_data['k'] = ''; $this->cookie_data['u'] = $user_id; @@ -636,7 +636,7 @@ class session // User does not exist // User is inactive // User is bot - if (!sizeof($this->data) || !is_array($this->data)) + if (!is_array($this->data) || !count($this->data)) { $this->cookie_data['k'] = ''; $this->cookie_data['u'] = ($bot) ? $bot : ANONYMOUS; @@ -1013,7 +1013,7 @@ class session } $db->sql_freeresult($result); - if (sizeof($del_user_id)) + if (count($del_user_id)) { // Delete expired sessions $sql = 'DELETE FROM ' . SESSIONS_TABLE . ' @@ -1147,7 +1147,7 @@ class session $where_sql[] = $_sql; } - $sql .= (sizeof($where_sql)) ? implode(' AND ', $where_sql) : ''; + $sql .= (count($where_sql)) ? implode(' AND ', $where_sql) : ''; $result = $db->sql_query($sql, $cache_ttl); $ban_triggered_by = 'user'; From e3859d894da3974d82491b228243c186c662bc9c Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 19 Mar 2017 21:46:20 +0700 Subject: [PATCH 03/11] [ticket/14972] Migrate from deprecated getMock() method to createMock() PHPBB3-14972 --- tests/attachment/delete_test.php | 4 +-- tests/attachment/upload_test.php | 13 ++++---- tests/auth/provider_apache_test.php | 2 +- tests/auth/provider_db_test.php | 2 +- tests/avatar/manager_test.php | 33 ++++++++++++------- tests/console/cache/purge_test.php | 6 ++-- tests/console/config/config_test.php | 2 +- tests/console/cron/cron_list_test.php | 2 +- tests/console/cron/run_test.php | 2 +- tests/console/thumbnail_test.php | 4 +-- tests/console/update/check_test.php | 2 +- tests/console/user/base.php | 4 +-- tests/content_visibility/delete_post_test.php | 2 +- .../get_forums_visibility_sql_test.php | 2 +- .../get_global_visibility_sql_test.php | 2 +- .../get_visibility_sql_test.php | 2 +- .../set_post_visibility_test.php | 4 +-- .../set_topic_visibility_test.php | 2 +- tests/dbal/db_tools_test.php | 16 ++++----- tests/dbal/migrator_tool_module_test.php | 2 +- tests/event/exception_listener_test.php | 2 +- tests/extension/metadata_manager_test.php | 2 +- tests/extension/modules_test.php | 2 +- tests/files/types_base_test.php | 4 +-- tests/files/types_form_test.php | 4 +-- tests/files/types_local_test.php | 2 +- tests/files/types_remote_test.php | 4 +-- tests/files/upload_test.php | 2 +- tests/functional/fileupload_remote_test.php | 2 +- tests/functions/build_url_test.php | 2 +- tests/functions/obtain_online_test.php | 2 +- .../get_username_string_test.php | 2 +- .../group_user_attributes_test.php | 4 +-- tests/installer/installer_config_test.php | 3 +- tests/installer/module_base_test.php | 2 +- tests/log/add_test.php | 4 +-- tests/log/delete_test.php | 2 +- tests/log/function_add_log_test.php | 4 +-- tests/log/function_view_log_test.php | 2 +- tests/notification/submit_post_base.php | 8 ++--- .../submit_post_type_topic_test.php | 2 +- tests/notification/user_list_trim_test.php | 2 +- tests/pagination/pagination_test.php | 2 +- tests/passwords/manager_test.php | 4 +-- tests/path_helper/path_helper_test.php | 6 ++-- tests/profilefields/type_bool_test.php | 16 +++++---- tests/profilefields/type_date_test.php | 6 ++-- tests/profilefields/type_dropdown_test.php | 16 +++++---- tests/profilefields/type_googleplus_test.php | 4 +-- tests/profilefields/type_int_test.php | 6 ++-- tests/profilefields/type_string_test.php | 6 ++-- tests/profilefields/type_url_test.php | 6 ++-- .../request/deactivated_super_global_test.php | 2 +- tests/request/request_test.php | 2 +- tests/security/hash_test.php | 2 +- tests/security/redirect_test.php | 2 +- tests/template/template_allfolder_test.php | 2 +- tests/template/template_events_test.php | 2 +- tests/template/template_includecss_test.php | 2 +- tests/template/template_test_case.php | 2 +- .../template/template_test_case_with_tree.php | 2 +- .../phpbb_functional_test_case.php | 10 +++--- .../phpbb_session_test_case.php | 2 +- .../phpbb_test_case_helpers.php | 8 ++++- tests/text_formatter/s9e/factory_test.php | 2 +- tests/text_formatter/s9e/parser_test.php | 6 ++-- tests/text_formatter/s9e/renderer_test.php | 10 +++--- .../generate_text_for_display_test.php | 2 +- tests/upload/fileupload_test.php | 2 +- tests/version/version_helper_remote_test.php | 6 +++- 70 files changed, 168 insertions(+), 141 deletions(-) diff --git a/tests/attachment/delete_test.php b/tests/attachment/delete_test.php index f1835dd37a..5ea9f26ea0 100644 --- a/tests/attachment/delete_test.php +++ b/tests/attachment/delete_test.php @@ -47,7 +47,7 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case $this->db = $this->new_dbal(); $db = $this->db; $this->resync = new \phpbb\attachment\resync($this->db); - $this->filesystem = $this->getMock('\phpbb\filesystem\filesystem', array('remove', 'exists')); + $this->filesystem = $this->createMock('\phpbb\filesystem\filesystem', array('remove', 'exists')); $this->filesystem->expects($this->any()) ->method('remove') ->willReturn(false); @@ -103,7 +103,7 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case */ public function test_attachment_delete_success($remove_success, $exists_success, $expected, $throw_exception = false) { - $this->filesystem = $this->getMock('\phpbb\filesystem\filesystem', array('remove', 'exists')); + $this->filesystem = $this->createMock('\phpbb\filesystem\filesystem', array('remove', 'exists')); if ($throw_exception) { $this->filesystem->expects($this->any()) diff --git a/tests/attachment/upload_test.php b/tests/attachment/upload_test.php index 235ecd082a..6aaae6ad61 100644 --- a/tests/attachment/upload_test.php +++ b/tests/attachment/upload_test.php @@ -81,7 +81,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case $config = $this->config; $this->db = $this->new_dbal(); $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), $this->config, $this->db, $phpbb_root_path, $phpEx); - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->filesystem = new \phpbb\filesystem\filesystem(); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); @@ -336,14 +336,14 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case */ public function test_image_upload($is_image, $plupload_active, $config_data, $expected) { - $filespec = $this->getMock('\phpbb\files\filespec', - array( + $filespec = $this->getMockBuilder('\phpbb\files\filespec') + ->setMethods(array( 'init_error', 'is_image', 'move_file', 'is_uploaded', - ), - array( + )) + ->setConstructorArgs(array( $this->filesystem, $this->language, $this->php_ini, @@ -351,7 +351,8 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case $this->phpbb_root_path, $this->mimetype_guesser, $this->plupload - )); + )) + ->getMock(); foreach ($config_data as $key => $value) { $this->config[$key] = $value; diff --git a/tests/auth/provider_apache_test.php b/tests/auth/provider_apache_test.php index 7d77d763fb..f30d19ef9d 100644 --- a/tests/auth/provider_apache_test.php +++ b/tests/auth/provider_apache_test.php @@ -27,7 +27,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case $config = new \phpbb\config\config(array()); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->user = new \phpbb\user($lang, '\phpbb\datetime'); $driver_helper = new \phpbb\passwords\driver\helper($config); $passwords_drivers = array( diff --git a/tests/auth/provider_db_test.php b/tests/auth/provider_db_test.php index 6ff77da564..b7d94ed046 100644 --- a/tests/auth/provider_db_test.php +++ b/tests/auth/provider_db_test.php @@ -37,7 +37,7 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case )); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); - $request = $this->getMock('\phpbb\request\request'); + $request = $this->createMock('\phpbb\request\request'); $user = new \phpbb\user($lang, '\phpbb\datetime'); $driver_helper = new \phpbb\passwords\driver\helper($config); $passwords_drivers = array( diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 9e826a3a59..ca9803bb8a 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -30,7 +30,7 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case global $phpbb_root_path, $phpEx; // Mock phpbb_container - $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + $phpbb_container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface'); $phpbb_container->expects($this->any()) ->method('get') ->will($this->returnArgument(0)); @@ -39,13 +39,13 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case // Prepare dependencies for avatar manager and driver $this->config = new \phpbb\config\config(array()); - $cache = $this->getMock('\phpbb\cache\driver\driver_interface'); + $cache = $this->createMock('\phpbb\cache\driver\driver_interface'); $path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), $filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); @@ -62,12 +62,17 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case $dispatcher = new phpbb_mock_event_dispatcher(); // $this->avatar_foobar will be needed later on - $this->avatar_foobar = $this->getMock('\phpbb\avatar\driver\foobar', array('get_name'), array($this->config, $imagesize, $phpbb_root_path, $phpEx, $path_helper, $cache)); + $this->avatar_foobar = $this->getMockBuilder('\phpbb\avatar\driver\foobar') + ->setMethods(array('get_name')) + ->setConstructorArgs(array($this->config, $imagesize, $phpbb_root_path, $phpEx, $path_helper, $cache)) + ->getMock(); $this->avatar_foobar->expects($this->any()) ->method('get_name') ->will($this->returnValue('avatar.driver.foobar')); // barfoo driver can't be mocked with constructor arguments - $this->avatar_barfoo = $this->getMock('\phpbb\avatar\driver\barfoo', array('get_name', 'get_config_name')); + $this->avatar_barfoo = $this->getMockBuilder('\phpbb\avatar\driver\barfoo') + ->setMethods(array('get_name', 'get_config_name')) + ->getMock(); $this->avatar_barfoo->expects($this->any()) ->method('get_name') ->will($this->returnValue('avatar.driver.barfoo')); @@ -82,11 +87,17 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case { if ($driver !== 'upload') { - $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($this->config, $imagesize, $phpbb_root_path, $phpEx, $path_helper, $cache)); + $cur_avatar = $this->getMockBuilder('\phpbb\avatar\driver\\' . $driver) + ->setMethods(array('get_name')) + ->setConstructorArgs(array($this->config, $imagesize, $phpbb_root_path, $phpEx, $path_helper, $cache)) + ->getMock(); } else { - $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($this->config, $phpbb_root_path, $phpEx, $filesystem, $path_helper, $dispatcher, $files_factory, $cache)); + $cur_avatar = $this->getMockBuilder('\phpbb\avatar\driver\\' . $driver) + ->setMethods(array('get_name')) + ->setConstructorArgs(array($this->config, $phpbb_root_path, $phpEx, $filesystem, $path_helper, $dispatcher, $files_factory, $cache)) + ->getMock(); } $cur_avatar->expects($this->any()) ->method('get_name') @@ -288,10 +299,10 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case { global $phpbb_root_path, $phpEx; - $user = $this->getMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime') - ); + $user = $this->getMockBuilder('\phpbb\user') + ->setMethods(array()) + ->setConstructorArgs(array(new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime')) + ->getMock(); $lang_array = array( array('FOOBAR_OFF', 'foobar_off'), array('FOOBAR_EXPLAIN', 'FOOBAR_EXPLAIN %s'), diff --git a/tests/console/cache/purge_test.php b/tests/console/cache/purge_test.php index 6c92660580..7a7e1dee5c 100644 --- a/tests/console/cache/purge_test.php +++ b/tests/console/cache/purge_test.php @@ -44,10 +44,10 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case $this->cache = new \phpbb\cache\driver\file($this->cache_dir); - $this->db = $this->getMock('\phpbb\db\driver\driver_interface'); + $this->db = $this->createMock('\phpbb\db\driver\driver_interface'); $this->config = new \phpbb\config\config(array('assets_version' => 1)); - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime') ); @@ -91,7 +91,7 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case public function get_command_tester() { $application = new Application(); - $application->add(new purge($this->user, $this->cache, $this->db, $this->getMock('\phpbb\auth\auth'), new \phpbb\log\dummy(), $this->config)); + $application->add(new purge($this->user, $this->cache, $this->db, $this->createMock('\phpbb\auth\auth'), new \phpbb\log\dummy(), $this->config)); $command = $application->find('cache:purge'); $this->command_name = $command->getName(); diff --git a/tests/console/config/config_test.php b/tests/console/config/config_test.php index 076316217d..7f8b2efce2 100644 --- a/tests/console/config/config_test.php +++ b/tests/console/config/config_test.php @@ -26,7 +26,7 @@ class phpbb_console_command_config_test extends phpbb_test_case $this->config = new \phpbb\config\config(array()); - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime') ); diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php index d56d5b040f..bfc897ac2e 100644 --- a/tests/console/cron/cron_list_test.php +++ b/tests/console/cron/cron_list_test.php @@ -34,7 +34,7 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index c4dffa3686..76c7bb27c4 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -40,7 +40,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case $config = $this->config = new \phpbb\config\config(array('cron_lock' => '0')); $this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db); - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); diff --git a/tests/console/thumbnail_test.php b/tests/console/thumbnail_test.php index 439e3623fa..ecce6f157c 100644 --- a/tests/console/thumbnail_test.php +++ b/tests/console/thumbnail_test.php @@ -50,14 +50,14 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case )); $this->db = $this->db = $this->new_dbal(); - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime') ); $this->phpbb_root_path = $phpbb_root_path; $this->phpEx = $phpEx; - $this->cache = $this->getMock('\phpbb\cache\service', array(), array(new phpbb_mock_cache(), $this->config, $this->db, $this->phpbb_root_path, $this->phpEx)); + $this->cache = $this->createMock('\phpbb\cache\service', array(), array(new phpbb_mock_cache(), $this->config, $this->db, $this->phpbb_root_path, $this->phpEx)); $this->cache->expects(self::any())->method('obtain_attach_extensions')->will(self::returnValue(array( 'png' => array('display_cat' => ATTACHMENT_CATEGORY_IMAGE), 'txt' => array('display_cat' => ATTACHMENT_CATEGORY_NONE), diff --git a/tests/console/update/check_test.php b/tests/console/update/check_test.php index 5cadc5cc97..6812ea61b8 100644 --- a/tests/console/update/check_test.php +++ b/tests/console/update/check_test.php @@ -84,7 +84,7 @@ class phpbb_console_command_check_test extends phpbb_test_case $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( $this->language, '\phpbb\datetime' )); diff --git a/tests/console/user/base.php b/tests/console/user/base.php index b84c0bb267..5382b9d896 100644 --- a/tests/console/user/base.php +++ b/tests/console/user/base.php @@ -39,7 +39,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case $phpbb_container->set('cache.driver', new phpbb_mock_cache()); $phpbb_container->set('notification_manager', new phpbb_mock_notification_manager()); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $cache = $phpbb_container->get('cache.driver'); @@ -62,7 +62,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case $this->language->expects($this->any()) ->method('lang') ->will($this->returnArgument(0)); - $user = $this->user = $this->getMock('\phpbb\user', array(), array( + $user = $this->user = $this->createMock('\phpbb\user', array(), array( $this->language, '\phpbb\datetime' )); diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php index 4ea95b0a96..4f978219c2 100644 --- a/tests/content_visibility/delete_post_test.php +++ b/tests/content_visibility/delete_post_test.php @@ -299,7 +299,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); // Create auth mock - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_get') ->with($this->stringContains('_'), $this->anything()) diff --git a/tests/content_visibility/get_forums_visibility_sql_test.php b/tests/content_visibility/get_forums_visibility_sql_test.php index 6c5066119e..fde2b62131 100644 --- a/tests/content_visibility/get_forums_visibility_sql_test.php +++ b/tests/content_visibility/get_forums_visibility_sql_test.php @@ -129,7 +129,7 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data $db = $this->new_dbal(); // Create auth mock - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_getf') ->with($this->stringContains('_'), $this->anything()) diff --git a/tests/content_visibility/get_global_visibility_sql_test.php b/tests/content_visibility/get_global_visibility_sql_test.php index 9ae4182673..eced3aa680 100644 --- a/tests/content_visibility/get_global_visibility_sql_test.php +++ b/tests/content_visibility/get_global_visibility_sql_test.php @@ -129,7 +129,7 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data $db = $this->new_dbal(); // Create auth mock - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_getf') ->with($this->stringContains('_'), $this->anything()) diff --git a/tests/content_visibility/get_visibility_sql_test.php b/tests/content_visibility/get_visibility_sql_test.php index aaaf64330e..18802fadbc 100644 --- a/tests/content_visibility/get_visibility_sql_test.php +++ b/tests/content_visibility/get_visibility_sql_test.php @@ -76,7 +76,7 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te $db = $this->new_dbal(); // Create auth mock - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_get') ->with($this->stringContains('_'), $this->anything()) diff --git a/tests/content_visibility/set_post_visibility_test.php b/tests/content_visibility/set_post_visibility_test.php index e33a1f30d5..8f629dca62 100644 --- a/tests/content_visibility/set_post_visibility_test.php +++ b/tests/content_visibility/set_post_visibility_test.php @@ -120,7 +120,7 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); @@ -173,7 +173,7 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); diff --git a/tests/content_visibility/set_topic_visibility_test.php b/tests/content_visibility/set_topic_visibility_test.php index 78431396c3..3db79c0fe0 100644 --- a/tests/content_visibility/set_topic_visibility_test.php +++ b/tests/content_visibility/set_topic_visibility_test.php @@ -84,7 +84,7 @@ class phpbb_content_visibility_set_topic_visibility_test extends phpbb_database_ $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index f9243e7266..006e752816 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -339,10 +339,10 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case public function test_perform_schema_changes_drop_tables() { - $db_tools = $this->getMock('\phpbb\db\tools\tools', array( - 'sql_table_exists', - 'sql_table_drop', - ), array(&$this->db)); + $db_tools = $this->getMockBuilder('\phpbb\db\tools\tools') + ->setMethods(array('sql_table_exists', 'sql_table_drop')) + ->setConstructorArgs(array(&$this->db)) + ->getMock(); // pretend all tables exist $db_tools->expects($this->any())->method('sql_table_exists') @@ -365,10 +365,10 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case public function test_perform_schema_changes_drop_columns() { - $db_tools = $this->getMock('\phpbb\db\tools\tools', array( - 'sql_column_exists', - 'sql_column_remove', - ), array(&$this->db)); + $db_tools = $this->getMockBuilder('\phpbb\db\tools\tools') + ->setMethods(array('sql_column_exists', 'sql_column_remove')) + ->setConstructorArgs(array(&$this->db)) + ->getMock(); // pretend all columns exist $db_tools->expects($this->any())->method('sql_column_exists') diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index 29b21166b6..a910c0acf5 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -36,7 +36,7 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $phpbb_extension_manager = new phpbb_mock_extension_manager($phpbb_root_path); diff --git a/tests/event/exception_listener_test.php b/tests/event/exception_listener_test.php index 08679a3ed8..fbae9e25b7 100644 --- a/tests/event/exception_listener_test.php +++ b/tests/event/exception_listener_test.php @@ -84,7 +84,7 @@ class exception_listener extends phpbb_test_case $exception_listener = new \phpbb\event\kernel_exception_subscriber($template, $lang); - $event = new \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent($this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'), $request, \Symfony\Component\HttpKernel\HttpKernelInterface::MASTER_REQUEST, $exception); + $event = new \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent($this->createMock('Symfony\Component\HttpKernel\HttpKernelInterface'), $request, \Symfony\Component\HttpKernel\HttpKernelInterface::MASTER_REQUEST, $exception); $exception_listener->on_kernel_exception($event); $response = $event->getResponse(); diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index 533da68c57..bb272b4df3 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -59,7 +59,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case new phpbb_mock_request() ), $filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $this->phpbb_root_path, $this->phpEx ); diff --git a/tests/extension/modules_test.php b/tests/extension/modules_test.php index 88634bc6ba..20b71e2812 100644 --- a/tests/extension/modules_test.php +++ b/tests/extension/modules_test.php @@ -46,7 +46,7 @@ class phpbb_extension_modules_test extends phpbb_test_case $this->module_manager = new \phpbb\module\module_manager( new \phpbb\cache\driver\dummy(), - $this->getMock('\phpbb\db\driver\driver_interface'), + $this->createMock('\phpbb\db\driver\driver_interface'), $this->extension_manager, MODULES_TABLE, dirname(__FILE__) . '/', diff --git a/tests/files/types_base_test.php b/tests/files/types_base_test.php index e630bf8c48..3b1cf68d50 100644 --- a/tests/files/types_base_test.php +++ b/tests/files/types_base_test.php @@ -39,7 +39,7 @@ class phpbb_files_types_base_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->filesystem = new \phpbb\filesystem\filesystem(); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); @@ -75,7 +75,7 @@ class phpbb_files_types_base_test extends phpbb_test_case */ public function test_check_upload_size($filename, $max_filesize, $expected) { - $php_ini = $this->getMock('\bantu\IniGetWrapper\IniGetWrapper'); + $php_ini = $this->createMock('\bantu\IniGetWrapper\IniGetWrapper'); $php_ini->expects($this->any()) ->method('getString') ->willReturn($max_filesize); diff --git a/tests/files/types_form_test.php b/tests/files/types_form_test.php index 925babb47f..25d79f6117 100644 --- a/tests/files/types_form_test.php +++ b/tests/files/types_form_test.php @@ -42,7 +42,7 @@ class phpbb_files_types_form_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->request->expects($this->any()) ->method('file') ->willReturn(array()); @@ -137,7 +137,7 @@ class phpbb_files_types_form_test extends phpbb_test_case */ public function test_upload_form($upload, $expected, $plupload = array()) { - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->request->expects($this->any()) ->method('file') ->willReturn($upload); diff --git a/tests/files/types_local_test.php b/tests/files/types_local_test.php index 31070de107..67e4c571f5 100644 --- a/tests/files/types_local_test.php +++ b/tests/files/types_local_test.php @@ -42,7 +42,7 @@ class phpbb_files_types_local_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->request->expects($this->any()) ->method('file') ->willReturn(array()); diff --git a/tests/files/types_remote_test.php b/tests/files/types_remote_test.php index 1a7d63d790..85ec2a528b 100644 --- a/tests/files/types_remote_test.php +++ b/tests/files/types_remote_test.php @@ -47,7 +47,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case $config = new \phpbb\config\config(array()); $this->config = $config; $this->config->set('remote_upload_verify', 0); - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->filesystem = new \phpbb\filesystem\filesystem(); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); @@ -102,7 +102,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case */ public function test_get_max_file_size($max_file_size, $link, $expected = array('URL_NOT_FOUND')) { - $php_ini = $this->getMock('\bantu\IniGetWrapper\IniGetWrapper', array('getString')); + $php_ini = $this->createMock('\bantu\IniGetWrapper\IniGetWrapper', array('getString')); $php_ini->expects($this->any()) ->method('getString') ->willReturn($max_file_size); diff --git a/tests/files/upload_test.php b/tests/files/upload_test.php index c41204a0d5..a9c2dca9d9 100644 --- a/tests/files/upload_test.php +++ b/tests/files/upload_test.php @@ -48,7 +48,7 @@ class phpbb_files_upload_test extends phpbb_test_case $config['rand_seed'] = ''; $config['rand_seed_last_update'] = time() + 600; - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->filesystem = new \phpbb\filesystem\filesystem(); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php index 88f8999005..a263394bbe 100644 --- a/tests/functional/fileupload_remote_test.php +++ b/tests/functional/fileupload_remote_test.php @@ -54,7 +54,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case $this->filesystem = new \phpbb\filesystem\filesystem(); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; $container = new phpbb_mock_container_builder(); diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php index 91a4a9ec66..a528cec5ae 100644 --- a/tests/functions/build_url_test.php +++ b/tests/functions/build_url_test.php @@ -28,7 +28,7 @@ class phpbb_build_url_test extends phpbb_test_case new phpbb_mock_request() ), new \phpbb\filesystem\filesystem(), - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, 'php' ); diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php index 778753e5d2..77b1079802 100644 --- a/tests/functions/obtain_online_test.php +++ b/tests/functions/obtain_online_test.php @@ -162,7 +162,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case $config['load_online_guests'] = $display_guests; $user = new phpbb_mock_lang(); $user->lang = $this->load_language(); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $acl_get_map = array( array('u_viewonline', true), array('u_viewprofile', true), diff --git a/tests/functions_content/get_username_string_test.php b/tests/functions_content/get_username_string_test.php index e79342d05d..ac36e37e93 100644 --- a/tests/functions_content/get_username_string_test.php +++ b/tests/functions_content/get_username_string_test.php @@ -18,7 +18,7 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case parent::setUp(); global $auth, $phpbb_dispatcher, $user; - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_get') ->with($this->stringContains('_'), $this->anything()) diff --git a/tests/functions_user/group_user_attributes_test.php b/tests/functions_user/group_user_attributes_test.php index 3124d57ba0..6968b1cd3a 100644 --- a/tests/functions_user/group_user_attributes_test.php +++ b/tests/functions_user/group_user_attributes_test.php @@ -134,11 +134,11 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes $cache = new phpbb_mock_cache; $db = $this->new_dbal(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_clear_prefetch'); $cache_driver = new \phpbb\cache\driver\dummy(); - $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + $phpbb_container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface'); $phpbb_container ->expects($this->any()) ->method('get') diff --git a/tests/installer/installer_config_test.php b/tests/installer/installer_config_test.php index 13ac325a79..1193d7aee4 100644 --- a/tests/installer/installer_config_test.php +++ b/tests/installer/installer_config_test.php @@ -23,8 +23,9 @@ class phpbb_installer_config_test extends phpbb_test_case public function setUp() { $phpbb_root_path = __DIR__ . './../../phpBB/'; - $filesystem = $this->getMock('\phpbb\filesystem\filesystem'); + $filesystem = $this->createMock('\phpbb\filesystem\filesystem'); $php_ini = $this->getMockBuilder('\bantu\IniGetWrapper\IniGetWrapper') + ->setMethods(array('getInt', 'getBytes')) ->getMock(); $php_ini->method('getInt') ->willReturn(-1); diff --git a/tests/installer/module_base_test.php b/tests/installer/module_base_test.php index 9578010047..71ec2b8db2 100644 --- a/tests/installer/module_base_test.php +++ b/tests/installer/module_base_test.php @@ -42,7 +42,7 @@ class module_base_test extends phpbb_test_case $this->module = new test_installer_module($module_collection, true, false); - $iohandler = $this->getMock('\phpbb\install\helper\iohandler\iohandler_interface'); + $iohandler = $this->createMock('\phpbb\install\helper\iohandler\iohandler_interface'); $config = new \phpbb\install\helper\config(new \phpbb\filesystem\filesystem(), new \bantu\IniGetWrapper\IniGetWrapper(), '', 'php'); $this->module->setup($config, $iohandler); } diff --git a/tests/log/add_test.php b/tests/log/add_test.php index 604c8364dc..469d4ebd69 100644 --- a/tests/log/add_test.php +++ b/tests/log/add_test.php @@ -28,7 +28,7 @@ class phpbb_log_add_test extends phpbb_database_test_case $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); @@ -59,7 +59,7 @@ class phpbb_log_add_test extends phpbb_database_test_case $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); diff --git a/tests/log/delete_test.php b/tests/log/delete_test.php index e8b75d01d9..04aa20d9ce 100644 --- a/tests/log/delete_test.php +++ b/tests/log/delete_test.php @@ -30,7 +30,7 @@ class phpbb_log_delete_test extends phpbb_database_test_case $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->data['user_id'] = 1; - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $this->log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); diff --git a/tests/log/function_add_log_test.php b/tests/log/function_add_log_test.php index 3b5537fc13..c3f1a0beba 100644 --- a/tests/log/function_add_log_test.php +++ b/tests/log/function_add_log_test.php @@ -159,11 +159,11 @@ class phpbb_log_function_add_log_test extends phpbb_database_test_case $db = $this->new_dbal(); $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php index ee9c3e5893..1f9717203c 100644 --- a/tests/log/function_view_log_test.php +++ b/tests/log/function_view_log_test.php @@ -378,7 +378,7 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); // Create auth mock - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $acl_get_map = array( array('f_read', 23, true), array('m_', 23, true), diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 21559c42a5..baa90f29b1 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -58,7 +58,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $db = $this->db; // Auth - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_get') ->with($this->stringContains('_'), @@ -92,7 +92,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $lang = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); // User - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( $lang, '\phpbb\datetime' )); @@ -105,8 +105,8 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c ); // Request - $type_cast_helper = $this->getMock('\phpbb\request\type_cast_helper_interface'); - $request = $this->getMock('\phpbb\request\request'); + $type_cast_helper = $this->createMock('\phpbb\request\type_cast_helper_interface'); + $request = $this->createMock('\phpbb\request\request'); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); diff --git a/tests/notification/submit_post_type_topic_test.php b/tests/notification/submit_post_type_topic_test.php index f14f305517..a51f0780b1 100644 --- a/tests/notification/submit_post_type_topic_test.php +++ b/tests/notification/submit_post_type_topic_test.php @@ -42,7 +42,7 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_ ), ))); - $phpbb_log = $this->getMock('\phpbb\log\dummy'); + $phpbb_log = $this->createMock('\phpbb\log\dummy'); } /** diff --git a/tests/notification/user_list_trim_test.php b/tests/notification/user_list_trim_test.php index 7d4dff6024..0de6294491 100644 --- a/tests/notification/user_list_trim_test.php +++ b/tests/notification/user_list_trim_test.php @@ -39,7 +39,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case $phpEx ); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_get') ->with($this->stringContains('_'), diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index 2d7d1671a8..3b1f1a45c3 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -29,7 +29,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case global $phpbb_dispatcher, $phpbb_root_path, $phpEx; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); diff --git a/tests/passwords/manager_test.php b/tests/passwords/manager_test.php index 0410d7035f..40e2849f9c 100644 --- a/tests/passwords/manager_test.php +++ b/tests/passwords/manager_test.php @@ -361,13 +361,13 @@ class phpbb_passwords_manager_test extends \phpbb_test_case { if ($use_new_interface) { - $test_driver = $this->getMock('\phpbb\passwords\driver\rehashable_driver_interface', array('needs_rehash', 'get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only')); + $test_driver = $this->createMock('\phpbb\passwords\driver\rehashable_driver_interface', array('needs_rehash', 'get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only')); $test_driver->method('needs_rehash') ->willReturn($needs_rehash); } else { - $test_driver = $this->getMock('\phpbb\passwords\driver\driver_interface', array('get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only')); + $test_driver = $this->createMock('\phpbb\passwords\driver\driver_interface', array('get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only')); } $config = new \phpbb\config\config(array()); diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php index 49dd40fbec..585d62847e 100644 --- a/tests/path_helper/path_helper_test.php +++ b/tests/path_helper/path_helper_test.php @@ -29,7 +29,7 @@ class phpbb_path_helper_test extends phpbb_test_case new phpbb_mock_request() ), new \phpbb\filesystem\filesystem(), - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $this->phpbb_root_path, 'php' ); @@ -180,7 +180,7 @@ class phpbb_path_helper_test extends phpbb_test_case */ public function test_update_web_root_path($input, $getPathInfo, $getRequestUri, $getScriptName, $correction) { - $symfony_request = $this->getMock('\phpbb\symfony_request', array(), array( + $symfony_request = $this->createMock('\phpbb\symfony_request', array(), array( new phpbb_mock_request(), )); $symfony_request->expects($this->any()) @@ -196,7 +196,7 @@ class phpbb_path_helper_test extends phpbb_test_case $path_helper = new \phpbb\path_helper( $symfony_request, new \phpbb\filesystem\filesystem(), - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $this->phpbb_root_path, 'php' ); diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php index 10239172c3..66e1578e8a 100644 --- a/tests/profilefields/type_bool_test.php +++ b/tests/profilefields/type_bool_test.php @@ -27,15 +27,17 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $user = $this->getMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $db = $this->createMock('phpbb\\db\\driver\\driver'); + + $user = $this->createMock('\phpbb\user'); $user->expects($this->any()) ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); - $lang = $this->getMock('\phpbb\profilefields\lang_helper', array(), array(null, null)); + $lang = $this->getMockBuilder('\phpbb\profilefields\lang_helper') + ->setMethods(array('get_options_lang', 'is_set', 'get')) + ->setConstructorArgs(array($db, LANG_TABLE)) + ->getMock(); $lang->expects($this->any()) ->method('get_options_lang'); @@ -48,8 +50,8 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case ->method('get') ->will($this->returnCallback(array($this, 'get'))); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); $this->cp = new \phpbb\profilefields\type\type_bool( $lang, diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php index e0807b2f9b..dc547c2d10 100644 --- a/tests/profilefields/type_date_test.php +++ b/tests/profilefields/type_date_test.php @@ -27,7 +27,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); @@ -45,8 +45,8 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case 'DATE_FORMAT' => 'm/d/Y', ); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); $this->cp = new \phpbb\profilefields\type\type_date( $request, diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php index ab02353fb9..96b2ad31be 100644 --- a/tests/profilefields/type_dropdown_test.php +++ b/tests/profilefields/type_dropdown_test.php @@ -27,18 +27,20 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $user = $this->getMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $db = $this->createMock('phpbb\\db\\driver\\driver'); + + $user = $this->createMock('\phpbb\user'); $user->expects($this->any()) ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); - $lang = $this->getMock('\phpbb\profilefields\lang_helper', array(), array(null, null)); + $lang = $this->getMockBuilder('\phpbb\profilefields\lang_helper') + ->setMethods(array('get_options_lang', 'is_set', 'get')) + ->setConstructorArgs(array($db, LANG_TABLE)) + ->getMock(); $lang->expects($this->any()) ->method('get_options_lang'); diff --git a/tests/profilefields/type_googleplus_test.php b/tests/profilefields/type_googleplus_test.php index 9222362214..06ba231e68 100644 --- a/tests/profilefields/type_googleplus_test.php +++ b/tests/profilefields/type_googleplus_test.php @@ -25,8 +25,8 @@ class phpbb_profilefield_type_googleplus_test extends phpbb_test_case $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->add_lang('ucp'); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); $this->field = new \phpbb\profilefields\type\type_googleplus( $request, diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php index 33f3f575c8..326c6051b3 100644 --- a/tests/profilefields/type_int_test.php +++ b/tests/profilefields/type_int_test.php @@ -26,7 +26,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); @@ -34,8 +34,8 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); $this->cp = new \phpbb\profilefields\type\type_int( $request, diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php index 7c7fa3f3e6..3febfd7c4f 100644 --- a/tests/profilefields/type_string_test.php +++ b/tests/profilefields/type_string_test.php @@ -26,7 +26,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case { global $request, $user, $cache, $phpbb_root_path, $phpEx; - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); @@ -35,8 +35,8 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); $this->cp = new \phpbb\profilefields\type\type_string( $request, diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php index 1d90e2c34c..0339dc2cdf 100644 --- a/tests/profilefields/type_url_test.php +++ b/tests/profilefields/type_url_test.php @@ -26,7 +26,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); @@ -34,8 +34,8 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); $this->cp = new \phpbb\profilefields\type\type_url( $request, diff --git a/tests/request/deactivated_super_global_test.php b/tests/request/deactivated_super_global_test.php index d45f9ca666..eabc79ed96 100644 --- a/tests/request/deactivated_super_global_test.php +++ b/tests/request/deactivated_super_global_test.php @@ -19,7 +19,7 @@ class phpbb_deactivated_super_global_test extends phpbb_test_case public function test_write_triggers_error() { $this->setExpectedTriggerError(E_USER_ERROR); - $obj = new \phpbb\request\deactivated_super_global($this->getMock('\phpbb\request\request_interface'), 'obj', \phpbb\request\request_interface::POST); + $obj = new \phpbb\request\deactivated_super_global($this->createMock('\phpbb\request\request_interface'), 'obj', \phpbb\request\request_interface::POST); $obj->offsetSet(0, 0); } } diff --git a/tests/request/request_test.php b/tests/request/request_test.php index ebaea1f9ef..47798177e1 100644 --- a/tests/request/request_test.php +++ b/tests/request/request_test.php @@ -39,7 +39,7 @@ class phpbb_request_test extends phpbb_test_case $_SERVER['HTTP_ACCEPT'] = 'application/json'; $_SERVER['HTTP_SOMEVAR'] = ''; - $this->type_cast_helper = $this->getMock('\phpbb\request\type_cast_helper_interface'); + $this->type_cast_helper = $this->createMock('\phpbb\request\type_cast_helper_interface'); $this->request = new \phpbb\request\request($this->type_cast_helper); } diff --git a/tests/security/hash_test.php b/tests/security/hash_test.php index 84d4fcf479..113c32bf7f 100644 --- a/tests/security/hash_test.php +++ b/tests/security/hash_test.php @@ -18,7 +18,7 @@ class phpbb_security_hash_test extends phpbb_test_case global $phpbb_container; $config = new \phpbb\config\config(array()); - $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + $phpbb_container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface'); $driver_helper = new \phpbb\passwords\driver\helper($config); $passwords_drivers = array( 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper), diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php index 40cb7d2f04..b912256cd5 100644 --- a/tests/security/redirect_test.php +++ b/tests/security/redirect_test.php @@ -67,7 +67,7 @@ class phpbb_security_redirect_test extends phpbb_security_test_base new phpbb_mock_request() ), new \phpbb\filesystem\filesystem(), - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $this->phpbb_root_path, 'php' ); diff --git a/tests/template/template_allfolder_test.php b/tests/template/template_allfolder_test.php index 63a6ef08ea..e7e4f21321 100644 --- a/tests/template/template_allfolder_test.php +++ b/tests/template/template_allfolder_test.php @@ -40,7 +40,7 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case new phpbb_mock_request() ), $filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 3a93c91e11..6bd4180e09 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -145,7 +145,7 @@ Zeta test event in all', new phpbb_mock_request() ), new \phpbb\filesystem\filesystem(), - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php index bc871aa612..a0992e084e 100644 --- a/tests/template/template_includecss_test.php +++ b/tests/template/template_includecss_test.php @@ -35,7 +35,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te new phpbb_mock_request() ), $filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 8adbafb1b2..78fa59c956 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -87,7 +87,7 @@ class phpbb_template_template_test_case extends phpbb_test_case new phpbb_mock_request() ), $filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 75e3918f44..b0c362b8d0 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -29,7 +29,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat new phpbb_mock_request() ), $filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index eb56049515..8b0edf2cdd 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -621,11 +621,11 @@ class phpbb_functional_test_case extends phpbb_test_case $db = $this->get_db(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $cache = new phpbb_mock_null_cache; @@ -663,17 +663,17 @@ class phpbb_functional_test_case extends phpbb_test_case $db = $this->get_db(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $cache = new phpbb_mock_null_cache; $cache_driver = new \phpbb\cache\driver\dummy(); - $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + $phpbb_container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface'); $phpbb_container ->expects($this->any()) ->method('get') diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php index b3d7780d14..1e71ca6e69 100644 --- a/tests/test_framework/phpbb_session_test_case.php +++ b/tests/test_framework/phpbb_session_test_case.php @@ -37,7 +37,7 @@ abstract class phpbb_session_test_case extends phpbb_database_test_case $phpbb_path_helper = new \phpbb\path_helper( $symfony_request, $phpbb_filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 7fb9a740b8..49c249daa3 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -382,10 +382,16 @@ class phpbb_test_case_helpers } // Mock the DAL, make it return data from the fixture + $db_driver = $this->test_case->getMockBuilder('phpbb\\db\\driver\\driver') + ->disableOriginalConstructor() + ->disableOriginalClone() + ->disableArgumentCloning() + ->disallowMockingUnknownTypes() + ->getMock(); $mb = $this->test_case->getMockBuilder('phpbb\\textformatter\\data_access'); $mb->setMethods(array('get_bbcodes', 'get_censored_words', 'get_smilies', 'get_styles')); $mb->setConstructorArgs(array( - $this->test_case->getMock('phpbb\\db\\driver\\driver'), + $db_driver, 'phpbb_bbcodes', 'phpbb_smilies', 'phpbb_styles', diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php index 3d3ea8b794..f92b04a6d2 100644 --- a/tests/text_formatter/s9e/factory_test.php +++ b/tests/text_formatter/s9e/factory_test.php @@ -235,7 +235,7 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case */ public function test_configure_events() { - $this->dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $this->dispatcher = $this->createMock('phpbb\\event\\dispatcher_interface'); $this->dispatcher ->expects($this->at(0)) ->method('trigger_event') diff --git a/tests/text_formatter/s9e/parser_test.php b/tests/text_formatter/s9e/parser_test.php index 4b9bbf9bb2..e10ebd29ee 100644 --- a/tests/text_formatter/s9e/parser_test.php +++ b/tests/text_formatter/s9e/parser_test.php @@ -19,7 +19,7 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case ->disableOriginalConstructor() ->getMock(); - $cache = $this->getMock('phpbb_mock_cache'); + $cache = $this->createMock('phpbb_mock_cache'); $cache->expects($this->once()) ->method('get') ->with('_foo_parser') @@ -172,7 +172,7 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case public function test_setup_event() { $container = $this->get_test_case_helpers()->set_s9e_services(); - $dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $dispatcher = $this->createMock('phpbb\\event\\dispatcher_interface'); $dispatcher ->expects($this->once()) ->method('trigger_event') @@ -202,7 +202,7 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case public function test_parse_event() { $container = $this->get_test_case_helpers()->set_s9e_services(); - $dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $dispatcher = $this->createMock('phpbb\\event\\dispatcher_interface'); $dispatcher ->expects($this->any()) ->method('trigger_event') diff --git a/tests/text_formatter/s9e/renderer_test.php b/tests/text_formatter/s9e/renderer_test.php index 175b90fdc7..672069590a 100644 --- a/tests/text_formatter/s9e/renderer_test.php +++ b/tests/text_formatter/s9e/renderer_test.php @@ -26,7 +26,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case 'getMock('phpbb_mock_cache'); + $cache = $this->createMock('phpbb_mock_cache'); $cache->expects($this->once()) ->method('get') ->with('_foo_renderer') @@ -50,7 +50,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case { $mock = $this->getMockForAbstractClass('s9e\\TextFormatter\\Renderer'); - $cache = $this->getMock('phpbb_mock_cache'); + $cache = $this->createMock('phpbb_mock_cache'); $cache->expects($this->once()) ->method('get') ->with('_foo_renderer') @@ -197,7 +197,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case $config = new \phpbb\config\config(array('allow_nocensors' => true)); - $auth = $test->getMock('phpbb\\auth\\auth'); + $auth = $test->createMock('phpbb\\auth\\auth'); $auth->expects($test->any()) ->method('acl_get') ->with('u_chgcensors') @@ -393,7 +393,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case public function test_setup_event() { $container = $this->get_test_case_helpers()->set_s9e_services(); - $dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $dispatcher = $this->createMock('phpbb\\event\\dispatcher_interface'); $dispatcher ->expects($this->once()) ->method('trigger_event') @@ -424,7 +424,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case public function test_render_event() { $container = $this->get_test_case_helpers()->set_s9e_services(); - $dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $dispatcher = $this->createMock('phpbb\\event\\dispatcher_interface'); $dispatcher ->expects($this->any()) ->method('trigger_event') diff --git a/tests/text_processing/generate_text_for_display_test.php b/tests/text_processing/generate_text_for_display_test.php index 9c7152a008..0adbdcca08 100644 --- a/tests/text_processing/generate_text_for_display_test.php +++ b/tests/text_processing/generate_text_for_display_test.php @@ -76,7 +76,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca $config = new \phpbb\config\config(array('allow_nocensors' => true)); - $auth = $this->getMock('phpbb\\auth\\auth'); + $auth = $this->createMock('phpbb\\auth\\auth'); $auth->expects($this->any()) ->method('acl_get') ->with('u_chgcensors') diff --git a/tests/upload/fileupload_test.php b/tests/upload/fileupload_test.php index 4516e3ad5a..b50c5291d4 100644 --- a/tests/upload/fileupload_test.php +++ b/tests/upload/fileupload_test.php @@ -50,7 +50,7 @@ class phpbb_fileupload_test extends phpbb_test_case $config['rand_seed'] = ''; $config['rand_seed_last_update'] = time() + 600; - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; $this->filesystem = new \phpbb\filesystem\filesystem(); diff --git a/tests/version/version_helper_remote_test.php b/tests/version/version_helper_remote_test.php index 35c3d92a3a..7b8d71181f 100644 --- a/tests/version/version_helper_remote_test.php +++ b/tests/version/version_helper_remote_test.php @@ -30,7 +30,11 @@ class version_helper_remote_test extends \phpbb_test_case )); $container = new \phpbb_mock_container_builder(); $db = new \phpbb\db\driver\factory($container); - $this->cache = $this->getMock('\phpbb\cache\service', array('get'), array(new \phpbb\cache\driver\dummy(), $config, $db, '../../', 'php')); + $this->cache = $this->getMockBuilder('\phpbb\cache\service') + ->setMethods(array('get')) + ->setConstructorArgs(array(new \phpbb\cache\driver\dummy(), $config, $db, '../../', 'php')) + ->getMock(); + $this->cache->expects($this->any()) ->method('get') ->with($this->anything()) From 003a9a6d2561890d3fc91182b3fef925e53fe212 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 7 May 2017 02:10:37 +0700 Subject: [PATCH 04/11] [ticket/14972] Fix use of deprecated media attachment constants PHPBB3-14972 --- .../migration/data/v320/remove_outdated_media.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php b/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php index c14d31f1c0..98b1c2d039 100644 --- a/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php +++ b/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php @@ -15,10 +15,17 @@ namespace phpbb\db\migration\data\v320; class remove_outdated_media extends \phpbb\db\migration\migration { + // Following constants were deprecated in 3.2 + // and moved from constants.php to compatibility_globals.php, + // thus define them as class constants + const ATTACHMENT_CATEGORY_WM = 2; + const ATTACHMENT_CATEGORY_RM = 3; + const ATTACHMENT_CATEGORY_QUICKTIME = 6; + protected $cat_id = array( - ATTACHMENT_CATEGORY_WM, - ATTACHMENT_CATEGORY_RM, - ATTACHMENT_CATEGORY_QUICKTIME, + self::ATTACHMENT_CATEGORY_WM, + self::ATTACHMENT_CATEGORY_RM, + self::ATTACHMENT_CATEGORY_QUICKTIME, ); static public function depends_on() From efd8e35a6be7b04cdb8c5deb512e1b583c0a9435 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 21 Mar 2017 22:31:18 +0700 Subject: [PATCH 05/11] [ticket/14972] Fix create_insert_array() declaration in admin_activate_user PHPBB3-14972 --- phpBB/phpbb/notification/type/admin_activate_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/notification/type/admin_activate_user.php b/phpBB/phpbb/notification/type/admin_activate_user.php index 9f2ae857ef..78c10ac36a 100644 --- a/phpBB/phpbb/notification/type/admin_activate_user.php +++ b/phpBB/phpbb/notification/type/admin_activate_user.php @@ -175,7 +175,7 @@ class admin_activate_user extends \phpbb\notification\type\base /** * {@inheritdoc} */ - public function create_insert_array($user, $pre_create_data) + public function create_insert_array($user, $pre_create_data = array()) { $this->set_data('user_actkey', $user['user_actkey']); $this->notification_time = $user['user_regdate']; From 221004b21ba89b26a6df6bae9b25dbdb139a594a Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 7 May 2017 03:26:01 +0700 Subject: [PATCH 06/11] [ticket/14972] Avoid using self as constant in tests PHPBB3-14972 --- tests/functional/extension_acp_test.php | 2 +- tests/functional/extension_controller_test.php | 2 +- tests/functional/extension_global_lang_test.php | 2 +- tests/functional/extension_module_test.php | 2 +- tests/functional/extension_permission_lang_test.php | 2 +- tests/functional/metadata_manager_test.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 8a71a5ce04..e980c5a04b 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -26,7 +26,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case { parent::setUpBeforeClass(); - self::$helper = new phpbb_test_case_helpers(self); + self::$helper = new phpbb_test_case_helpers(__CLASS__); self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/../extension/ext/', self::$fixtures); } diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 18eb9ad4c6..58c3878b8b 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -34,7 +34,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c { parent::setUpBeforeClass(); - self::$helper = new phpbb_test_case_helpers(self); + self::$helper = new phpbb_test_case_helpers(__CLASS__); self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures); } diff --git a/tests/functional/extension_global_lang_test.php b/tests/functional/extension_global_lang_test.php index f615114c08..a1e2547745 100644 --- a/tests/functional/extension_global_lang_test.php +++ b/tests/functional/extension_global_lang_test.php @@ -30,7 +30,7 @@ class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_ { parent::setUpBeforeClass(); - self::$helper = new phpbb_test_case_helpers(self); + self::$helper = new phpbb_test_case_helpers(__CLASS__); self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures); } diff --git a/tests/functional/extension_module_test.php b/tests/functional/extension_module_test.php index 95107665cd..d3a66b9b35 100644 --- a/tests/functional/extension_module_test.php +++ b/tests/functional/extension_module_test.php @@ -29,7 +29,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case { parent::setUpBeforeClass(); - self::$helper = new phpbb_test_case_helpers(self); + self::$helper = new phpbb_test_case_helpers(__CLASS__); self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures); } diff --git a/tests/functional/extension_permission_lang_test.php b/tests/functional/extension_permission_lang_test.php index 92d8d596c7..f570d45215 100644 --- a/tests/functional/extension_permission_lang_test.php +++ b/tests/functional/extension_permission_lang_test.php @@ -30,7 +30,7 @@ class phpbb_functional_extension_permission_lang_test extends phpbb_functional_t { parent::setUpBeforeClass(); - self::$helper = new phpbb_test_case_helpers(self); + self::$helper = new phpbb_test_case_helpers(__CLASS__); self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures); } diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php index 0d2fdf082e..8456c40f00 100644 --- a/tests/functional/metadata_manager_test.php +++ b/tests/functional/metadata_manager_test.php @@ -35,7 +35,7 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case { parent::setUpBeforeClass(); - self::$helper = new phpbb_test_case_helpers(self); + self::$helper = new phpbb_test_case_helpers(__CLASS__); self::$helper->copy_ext_fixtures(dirname(__FILE__) . '/fixtures/ext/', self::$fixtures); } From 0552666cf58c46f14324593ea6862d47efaedf40 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 9 May 2017 02:13:24 +0700 Subject: [PATCH 07/11] [ticket/14972] Fix test_collection_with_mask test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In PHP 7.2, the severity of the message “Use of undefined constant” was raised from E_NOTICE to E_WARNING, so calling $array[ITEM] causes warning caught by error collector. Use undefined offset notice to get an empty message as such. PHPBB3-14972 --- tests/error_collector_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php index 273284c8fc..8ed89bbe52 100644 --- a/tests/error_collector_test.php +++ b/tests/error_collector_test.php @@ -52,8 +52,8 @@ class phpbb_error_collector_test extends phpbb_test_case 1/0; $line = __LINE__; // Cause a notice - $array = array('ITEM' => 'value'); - $value = $array[ITEM]; $line2 = __LINE__; + $array = array(0 => 'value'); + $value = $array[1]; $line2 = __LINE__; $collector->uninstall(); From e336a62fa31b0ed6301cae75739f3f4601636e38 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 27 Jun 2017 23:54:37 +0700 Subject: [PATCH 08/11] [ticket/14972] Update tests matrix to reflect bumping PHP version requirement PHPBB3-14972 --- .travis.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index ad8179e6a2..6466c3bfb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,19 +2,15 @@ language: php matrix: include: - - php: 5.5 + - php: 5.6 env: DB=none;NOTESTS=1 - - php: 5.5 - env: DB=mysqli - - php: 5.5 - env: DB=mysql - - php: 5.5 + - php: 5.6 env: DB=mariadb - - php: 5.5 + - php: 5.6 env: DB=postgres - - php: 5.5 + - php: 5.6 env: DB=sqlite3 - - php: 5.5 + - php: 5.6 env: DB=mysqli;SLOWTESTS=1 - php: 5.6 env: DB=mysqli From 67a65e37884ed0b40c8bc6d0b9b0e2f0d1889194 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 9 May 2017 01:07:38 +0700 Subject: [PATCH 09/11] [ticket/14972] Fix find_key_index method PHPBB3-14972 --- phpBB/phpbb/template/context.php | 87 ++++++++++++++------------------ 1 file changed, 37 insertions(+), 50 deletions(-) diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 392efd5933..b8addc76d0 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -142,7 +142,7 @@ class context */ protected function set_num_rows(&$loop_data) { - $s_num_rows = sizeof($loop_data); + $s_num_rows = count($loop_data); foreach ($loop_data as &$mod_block) { foreach ($mod_block as $sub_block_name => &$sub_block) @@ -194,16 +194,16 @@ class context { // Nested block. $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; + $blockcount = count($blocks) - 1; $str = &$this->tpldata; for ($i = 0; $i < $blockcount; $i++) { $str = &$str[$blocks[$i]]; - $str = &$str[sizeof($str) - 1]; + $str = &$str[count($str) - 1]; } - $s_row_count = isset($str[$blocks[$blockcount]]) ? sizeof($str[$blocks[$blockcount]]) : 0; + $s_row_count = isset($str[$blocks[$blockcount]]) ? count($str[$blocks[$blockcount]]) : 0; $vararray['S_ROW_COUNT'] = $vararray['S_ROW_NUM'] = $s_row_count; // Assign S_FIRST_ROW @@ -231,7 +231,7 @@ class context else { // Top-level block. - $s_row_count = (isset($this->tpldata[$blockname])) ? sizeof($this->tpldata[$blockname]) : 0; + $s_row_count = (isset($this->tpldata[$blockname])) ? count($this->tpldata[$blockname]) : 0; $vararray['S_ROW_COUNT'] = $vararray['S_ROW_NUM'] = $s_row_count; // Assign S_FIRST_ROW @@ -285,7 +285,7 @@ class context { // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; + $blockcount = count($blocks) - 1; $block = $this->tpldata; for ($i = 0; $i <= $blockcount; $i++) @@ -296,17 +296,17 @@ class context if (strpos($blocks[$i], '[]') === $pos) { - $index = sizeof($block[$name]) - 1; + $index = count($block[$name]) - 1; } else { - $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1); + $index = min((int) substr($blocks[$i], $pos + 1, -1), count($block[$name]) - 1); } } else { $name = $blocks[$i]; - $index = sizeof($block[$name]) - 1; + $index = count($block[$name]) - 1; } $block = $block[$name]; $block = $block[$index]; @@ -355,39 +355,26 @@ class context { // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; + $blockcount = count($blocks) - 1; $block = $this->tpldata; for ($i = 0; $i < $blockcount; $i++) { - if (($pos = strpos($blocks[$i], '[')) !== false) - { - $name = substr($blocks[$i], 0, $pos); + $pos = strpos($blocks[$i], '['); + $name = ($pos !== false) ? substr($blocks[$i], 0, $pos) : $blocks[$i]; - if (strpos($blocks[$i], '[]') === $pos) - { - $index = sizeof($block[$name]) - 1; - } - else - { - $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1); - } - } - else - { - $name = $blocks[$i]; - $index = sizeof($block[$name]) - 1; - } if (!isset($block[$name])) { return false; } - $block = $block[$name]; - if (!isset($block[$index])) + + $index = (!$pos || strpos($blocks[$i], '[]') === $pos) ? (count($block[$name]) - 1) : (min((int) substr($blocks[$i], $pos + 1, -1), count($block[$name]) - 1)); + + if (!isset($block[$name][$index])) { return false; } - $block = $block[$index]; + $block = $block[$name][$index]; } if (!isset($block[$blocks[$i]])) @@ -397,9 +384,9 @@ class context $block = $block[$blocks[$i]]; // Traverse the last block // Change key to zero (change first position) if false and to last position if true - if ($key === false || $key === true) + if (is_bool($key)) { - return ($key === false) ? 0 : sizeof($block) - 1; + return (!$key) ? 0 : count($block) - 1; } // Get correct position if array given @@ -416,7 +403,7 @@ class context } } - return (is_int($key) && ((0 <= $key) && ($key < sizeof($block)))) ? $key : false; + return (is_int($key) && ((0 <= $key) && ($key < count($block)))) ? $key : false; } /** @@ -453,7 +440,7 @@ class context // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; + $blockcount = count($blocks) - 1; $block = &$this->tpldata; for ($i = 0; $i < $blockcount; $i++) @@ -464,17 +451,17 @@ class context if (strpos($blocks[$i], '[]') === $pos) { - $index = sizeof($block[$name]) - 1; + $index = count($block[$name]) - 1; } else { - $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1); + $index = min((int) substr($blocks[$i], $pos + 1, -1), count($block[$name]) - 1); } } else { $name = $blocks[$i]; - $index = sizeof($block[$name]) - 1; + $index = count($block[$name]) - 1; } $block = &$block[$name]; $block = &$block[$index]; @@ -496,7 +483,7 @@ class context // Change key to zero (change first position) if false and to last position if true if ($key === false || $key === true) { - $key = ($key === false) ? 0 : sizeof($block); + $key = ($key === false) ? 0 : count($block); } // Get correct position if array given @@ -526,9 +513,9 @@ class context if ($mode == 'insert') { // Make sure we are not exceeding the last iteration - if ($key >= sizeof($block)) + if ($key >= count($block)) { - $key = sizeof($block); + $key = count($block); unset($block[($key - 1)]['S_LAST_ROW']); $vararray['S_LAST_ROW'] = true; } @@ -543,7 +530,7 @@ class context $vararray['S_BLOCK_NAME'] = $name; // Re-position template blocks - for ($i = sizeof($block); $i > $key; $i--) + for ($i = count($block); $i > $key; $i--) { $block[$i] = $block[$i-1]; @@ -561,12 +548,12 @@ class context if ($mode == 'change') { // If key is out of bounds, do not change anything - if ($key > sizeof($block) || $key < 0) + if ($key > count($block) || $key < 0) { return false; } - if ($key == sizeof($block)) + if ($key == count($block)) { $key--; } @@ -580,26 +567,26 @@ class context if ($mode == 'delete') { // If we are exceeding last iteration, do not delete anything - if ($key > sizeof($block) || $key < 0) + if ($key > count($block) || $key < 0) { return false; } // If we are positioned at the end, we remove the last element - if ($key == sizeof($block)) + if ($key == count($block)) { $key--; } // We are deleting the last element in the block, so remove the block - if (sizeof($block) === 1) + if (count($block) === 1) { $block = null; // unset($block); does not work on references return true; } // Re-position template blocks - for ($i = $key; $i < sizeof($block)-1; $i++) + for ($i = $key; $i < count($block)-1; $i++) { $block[$i] = $block[$i+1]; $block[$i]['S_ROW_COUNT'] = $block[$i]['S_ROW_NUM'] = $i; @@ -610,7 +597,7 @@ class context // Set first and last elements again, in case they were removed $block[0]['S_FIRST_ROW'] = true; - $block[sizeof($block)-1]['S_LAST_ROW'] = true; + $block[count($block)-1]['S_LAST_ROW'] = true; return true; } @@ -631,13 +618,13 @@ class context { // Nested block. $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; + $blockcount = count($blocks) - 1; $str = &$this->tpldata; for ($i = 0; $i < $blockcount; $i++) { $str = &$str[$blocks[$i]]; - $str = &$str[sizeof($str) - 1]; + $str = &$str[count($str) - 1]; } unset($str[$blocks[$blockcount]]); From 797234e416c40cd602f9ee46d63bff53de303800 Mon Sep 17 00:00:00 2001 From: rxu Date: Wed, 28 Jun 2017 00:58:03 +0700 Subject: [PATCH 10/11] [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 . '
    '; - if (sizeof($filenames) != 1) + if (count($filenames) != 1) { fwrite($common_fp, (($entry['common']) ? ",\n" : '') . "\t'$var' => '" . $lang[$var] . "'"); $entry['common'] = true; } - else if (sizeof($filenames) == 1) + else if (count($filenames) == 1) { // Merge logical - hardcoded $fname = (preg_match('#^(' . implode('|', $merge) . ')#', $filenames[0], $match)) ? $match[0] . '.php' : str_replace($ext, 'php', $filenames[0]); diff --git a/phpBB/develop/search_fill.php b/phpBB/develop/search_fill.php index 07c4024b2f..4f684b5b27 100644 --- a/phpBB/develop/search_fill.php +++ b/phpBB/develop/search_fill.php @@ -89,7 +89,7 @@ for(;$postcounter <= $max_post_id; $postcounter += $batchsize) $rowset = $db->sql_fetchrowset($result); $db->sql_freeresult($result); - $post_rows = sizeof($rowset); + $post_rows = count($rowset); if( $post_rows ) { diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 9b5c668880..3e6919c88a 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -627,7 +627,7 @@ $min = ($i < $j) ? $i : $j;
    if (isset($forum) && $forum == 5)
    -

    The empty() function is useful if you want to check if a variable is not set or being empty (an empty string, 0 as an integer or string, NULL, false, an empty array or a variable declared, but without a value in a class). Therefore empty should be used in favor of isset($array) && sizeof($array) > 0 - this can be written in a shorter way as !empty($array).

    +

    The empty() function is useful if you want to check if a variable is not set or being empty (an empty string, 0 as an integer or string, NULL, false, an empty array or a variable declared, but without a value in a class). Therefore empty should be used in favor of isset($array) && count($array) > 0 - this can be written in a shorter way as !empty($array).

    Switch statements:

    Switch/case code blocks can get a bit long sometimes. To have some level of notice and being in-line with the opening/closing brace requirement (where they are on the same line for better readability), this also applies to switch/case code blocks and the breaks. An example:

    @@ -994,9 +994,9 @@ $sql = $db->sql_build_query('SELECT', $sql_array);

    Operations in loop definition:

    Always try to optimize your loops if operations are going on at the comparing part, since this part is executed every time the loop is parsed through. For assignments a descriptive name should be chosen. Example:

    -

    // On every iteration the sizeof function is called

    +

    // On every iteration the count function is called

    -for ($i = 0; $i < sizeof($post_data); $i++)
    +for ($i = 0; $i < count($post_data); $i++)
     {
     	do_something();
     }
    @@ -1004,7 +1004,7 @@ for ($i = 0; $i < sizeof($post_data); $i++)

    // You are able to assign the (not changing) result within the loop itself

    -for ($i = 0, $size = sizeof($post_data); $i < $size; $i++)
    +for ($i = 0, $size = count($post_data); $i < $size; $i++)
     {
     	do_something();
     }
    diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 3cfe5de293..d3559eaa32 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -190,7 +190,7 @@ class acp_attachments validate_config_vars($display_vars['vars'], $cfg_array, $error); // Do not write values if there is an error - if (sizeof($error)) + if (count($error)) { $submit = false; } @@ -226,7 +226,7 @@ class acp_attachments // Check Settings $this->test_upload($error, $this->new_config['upload_path'], false); - if (!sizeof($error)) + if (!count($error)) { trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); } @@ -256,14 +256,14 @@ class acp_attachments $supported_types = get_supported_image_types(); // Check Thumbnail Support - if (!$this->new_config['img_imagick'] && (!isset($supported_types['format']) || !sizeof($supported_types['format']))) + if (!$this->new_config['img_imagick'] && (!isset($supported_types['format']) || !count($supported_types['format']))) { $this->new_config['img_create_thumbnail'] = 0; } $template->assign_vars(array( 'U_SEARCH_IMAGICK' => $this->u_action . '&action=imgmagick', - 'S_THUMBNAIL_SUPPORT' => (!$this->new_config['img_imagick'] && (!isset($supported_types['format']) || !sizeof($supported_types['format']))) ? false : true) + 'S_THUMBNAIL_SUPPORT' => (!$this->new_config['img_imagick'] && (!isset($supported_types['format']) || !count($supported_types['format']))) ? false : true) ); // Secure Download Options - Same procedure as with banning @@ -290,7 +290,7 @@ class acp_attachments $template->assign_vars(array( 'S_SECURE_DOWNLOADS' => $this->new_config['secure_downloads'], 'S_DEFINED_IPS' => ($defined_ips != '') ? true : false, - 'S_WARNING' => (sizeof($error)) ? true : false, + 'S_WARNING' => (count($error)) ? true : false, 'WARNING_MSG' => implode('
    ', $error), 'DEFINED_IPS' => $defined_ips, @@ -363,7 +363,7 @@ class acp_attachments // Generate correct Change List $extensions = array(); - for ($i = 0, $size = sizeof($extension_change_list); $i < $size; $i++) + for ($i = 0, $size = count($extension_change_list); $i < $size; $i++) { $extensions[$extension_change_list[$i]]['group_id'] = $group_select_list[$i]; } @@ -390,7 +390,7 @@ class acp_attachments // Delete Extension? $extension_id_list = $request->variable('extension_id_list', array(0)); - if (sizeof($extension_id_list)) + if (count($extension_id_list)) { $sql = 'SELECT extension FROM ' . EXTENSIONS_TABLE . ' @@ -420,7 +420,7 @@ class acp_attachments if ($add_extension && $add) { - if (!sizeof($error)) + if (!count($error)) { $sql = 'SELECT extension_id FROM ' . EXTENSIONS_TABLE . " @@ -433,7 +433,7 @@ class acp_attachments } $db->sql_freeresult($result); - if (!sizeof($error)) + if (!count($error)) { $sql_ary = array( 'group_id' => $add_extension_group, @@ -447,7 +447,7 @@ class acp_attachments } } - if (!sizeof($error)) + if (!count($error)) { $notify[] = $user->lang['EXTENSIONS_UPDATED']; } @@ -558,7 +558,7 @@ class acp_attachments $db->sql_freeresult($result); } - if (!sizeof($error)) + if (!count($error)) { // Ok, build the update/insert array $upload_icon = $request->variable('upload_icon', 'no_image'); @@ -575,7 +575,7 @@ class acp_attachments $max_filesize = 0; } - if (!sizeof($allowed_forums)) + if (!count($allowed_forums)) { $forum_select = false; } @@ -612,7 +612,7 @@ class acp_attachments $extension_list = $request->variable('extensions', array(0)); - if ($action == 'edit' && sizeof($extension_list)) + if ($action == 'edit' && count($extension_list)) { $sql = 'UPDATE ' . EXTENSIONS_TABLE . " SET group_id = 0 @@ -620,7 +620,7 @@ class acp_attachments $db->sql_query($sql); } - if (sizeof($extension_list)) + if (count($extension_list)) { $sql = 'UPDATE ' . EXTENSIONS_TABLE . " SET group_id = $group_id @@ -630,7 +630,7 @@ class acp_attachments $cache->destroy('_extensions'); - if (!sizeof($error)) + if (!count($error)) { $notify[] = $user->lang['SUCCESS_EXTENSION_GROUP_' . strtoupper($action)]; } @@ -806,7 +806,7 @@ class acp_attachments 'S_FILENAME_LIST' => $filename_list, 'S_EDIT_GROUP' => true, 'S_NO_IMAGE' => $no_image_select, - 'S_FORUM_IDS' => (sizeof($forum_ids)) ? true : false, + 'S_FORUM_IDS' => (count($forum_ids)) ? true : false, 'U_EXTENSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=extensions"), 'U_BACK' => $this->u_action, @@ -928,7 +928,7 @@ class acp_attachments $add_files = (isset($_POST['add'])) ? array_keys($request->variable('add', array('' => 0))) : array(); $post_ids = $request->variable('post_id', array('' => 0)); - if (sizeof($delete_files)) + if (count($delete_files)) { $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' @@ -951,7 +951,7 @@ class acp_attachments $db->sql_freeresult($result); } - if (sizeof($delete_files)) + if (count($delete_files)) { $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE ' . $db->sql_in_set('attach_id', array_keys($delete_files)); @@ -971,7 +971,7 @@ class acp_attachments } unset($add_files); - if (sizeof($upload_list)) + if (count($upload_list)) { $template->assign_var('S_UPLOADING_FILES', true); @@ -1094,7 +1094,7 @@ class acp_attachments { $delete_files = (isset($_POST['delete'])) ? array_keys($request->variable('delete', array('' => 0))) : array(); - if (sizeof($delete_files)) + if (count($delete_files)) { // Select those attachments we want to delete... $sql = 'SELECT real_filename @@ -1110,7 +1110,7 @@ class acp_attachments if ($num_deleted = $this->attachment_manager->delete('attach', $delete_files)) { - if (sizeof($delete_files) != $num_deleted) + if (count($delete_files) != $num_deleted) { $error[] = $user->lang['FILES_GONE']; } @@ -1231,7 +1231,7 @@ class acp_attachments // Grab extensions $extensions = $cache->obtain_attach_extensions(true); - for ($i = 0, $end = sizeof($attachments_list); $i < $end; ++$i) + for ($i = 0, $end = count($attachments_list); $i < $end; ++$i) { $row = $attachments_list[$i]; @@ -1266,7 +1266,7 @@ class acp_attachments break; } - if (sizeof($error)) + if (count($error)) { $template->assign_vars(array( 'S_WARNING' => true, @@ -1274,7 +1274,7 @@ class acp_attachments ); } - if (sizeof($notify)) + if (count($notify)) { $template->assign_vars(array( 'S_NOTIFY' => true, @@ -1443,7 +1443,7 @@ class acp_attachments $row['group_name'] = $user->lang['NOT_ASSIGNED']; $group_name[] = $row; - for ($i = 0, $groups_size = sizeof($group_name); $i < $groups_size; $i++) + for ($i = 0, $groups_size = count($group_name); $i < $groups_size; $i++) { if ($default_group === false) { @@ -1676,7 +1676,7 @@ class acp_attachments } $db->sql_freeresult($result); - if (sizeof($iplist)) + if (count($iplist)) { foreach ($iplist as $ip_entry) { @@ -1686,7 +1686,7 @@ class acp_attachments } } - if (sizeof($hostlist)) + if (count($hostlist)) { foreach ($hostlist as $host_entry) { @@ -1709,7 +1709,7 @@ class acp_attachments { $unip_sql = $request->variable('unip', array(0)); - if (sizeof($unip_sql)) + if (count($unip_sql)) { $l_unip_list = ''; diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index f958ae93c7..52f695e9d7 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -494,7 +494,7 @@ class acp_bbcodes // Pad backreference numbers from tokens if (preg_match_all('/(?lang['FORM_INVALID']; } // Do not write values if there is an error - if (sizeof($error)) + if (count($error)) { $submit = false; } @@ -690,7 +690,7 @@ class acp_board 'L_TITLE' => $user->lang[$display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], - 'S_ERROR' => (sizeof($error)) ? true : false, + 'S_ERROR' => (count($error)) ? true : false, 'ERROR_MSG' => implode('
    ', $error), 'U_ACTION' => $this->u_action) @@ -1110,7 +1110,7 @@ class acp_board $db->sql_query($sql); // Already emptied for all... - if (sizeof($values)) + if (count($values)) { // Set for selected forums $sql = 'UPDATE ' . FORUMS_TABLE . ' diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php index e89b16663c..8bd357bc91 100644 --- a/phpBB/includes/acp/acp_bots.php +++ b/phpBB/includes/acp/acp_bots.php @@ -55,7 +55,7 @@ class acp_bots switch ($action) { case 'activate': - if ($bot_id || sizeof($mark)) + if ($bot_id || count($mark)) { $sql_id = ($bot_id) ? " = $bot_id" : ' IN (' . implode(', ', $mark) . ')'; @@ -69,7 +69,7 @@ class acp_bots break; case 'deactivate': - if ($bot_id || sizeof($mark)) + if ($bot_id || count($mark)) { $sql_id = ($bot_id) ? " = $bot_id" : ' IN (' . implode(', ', $mark) . ')'; @@ -83,7 +83,7 @@ class acp_bots break; case 'delete': - if ($bot_id || sizeof($mark)) + if ($bot_id || count($mark)) { if (confirm_box(true)) { @@ -109,7 +109,7 @@ class acp_bots WHERE bot_id $sql_id"; $db->sql_query($sql); - if (sizeof($user_id_ary)) + if (count($user_id_ary)) { $_tables = array(USERS_TABLE, USER_GROUP_TABLE); foreach ($_tables as $table) @@ -207,7 +207,7 @@ class acp_bots $error[] = $user->lang['BOT_NAME_TAKEN']; } - if (!sizeof($error)) + if (!count($error)) { // New bot? Create a new user and group entry if ($action == 'add') @@ -338,7 +338,7 @@ class acp_bots 'L_TITLE' => $user->lang['BOT_' . $l_title], 'U_ACTION' => $this->u_action . "&id=$bot_id&action=$action", 'U_BACK' => $this->u_action, - 'ERROR_MSG' => (sizeof($error)) ? implode('
    ', $error) : '', + 'ERROR_MSG' => (count($error)) ? implode('
    ', $error) : '', 'BOT_NAME' => $bot_row['bot_name'], 'BOT_IP' => $bot_row['bot_ip'], @@ -348,7 +348,7 @@ class acp_bots 'S_ACTIVE_OPTIONS' => $s_active_options, 'S_STYLE_OPTIONS' => $style_select, 'S_LANG_OPTIONS' => $lang_select, - 'S_ERROR' => (sizeof($error)) ? true : false, + 'S_ERROR' => (count($error)) ? true : false, ) ); diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 00c7ef40c0..b98756a34b 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -59,7 +59,7 @@ class acp_database $format = $request->variable('method', ''); $where = $request->variable('where', ''); - if (!sizeof($table)) + if (!count($table)) { trigger_error($user->lang['TABLE_SELECT_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -495,7 +495,7 @@ function sanitize_data_mssql($text) { $val[] = "'" . $value . "'"; } - if (sizeof($matches[0])) + if (count($matches[0])) { $val[] = 'char(' . ord(array_shift($matches[0])) . ')'; } @@ -519,7 +519,7 @@ function sanitize_data_oracle($text) { $val[] = "'" . $value . "'"; } - if (sizeof($matches[0])) + if (count($matches[0])) { $val[] = 'chr(' . ord(array_shift($matches[0])) . ')'; } @@ -541,7 +541,7 @@ function sanitize_data_generic($text) { $val[] = "'" . $value . "'"; } - if (sizeof($matches[0])) + if (count($matches[0])) { $val[] = "'" . array_shift($matches[0]) . "'"; } @@ -583,7 +583,7 @@ function fgetd_seekless(&$fp, $delim, $read, $seek, $eof, $buffer = 8192) static $array = array(); static $record = ''; - if (!sizeof($array)) + if (!count($array)) { while (!$eof($fp)) { @@ -605,7 +605,7 @@ function fgetd_seekless(&$fp, $delim, $read, $seek, $eof, $buffer = 8192) } } - if (sizeof($array)) + if (count($array)) { return array_shift($array); } diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index 57eefad02d..5a1fbac9f6 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -68,7 +68,7 @@ class acp_email $error[] = $user->lang['NO_EMAIL_MESSAGE']; } - if (!sizeof($error)) + if (!count($error)) { if (!empty($usernames)) { @@ -168,7 +168,7 @@ class acp_email { $i = 0; - if (sizeof($email_list)) + if (count($email_list)) { $j++; } @@ -235,16 +235,16 @@ class acp_email ); extract($phpbb_dispatcher->trigger_event('core.acp_email_send_before', compact($vars))); - for ($i = 0, $size = sizeof($email_list); $i < $size; $i++) + for ($i = 0, $size = count($email_list); $i < $size; $i++) { $used_lang = $email_list[$i][0]['lang']; $used_method = $email_list[$i][0]['method']; - for ($j = 0, $list_size = sizeof($email_list[$i]); $j < $list_size; $j++) + for ($j = 0, $list_size = count($email_list[$i]); $j < $list_size; $j++) { $email_row = $email_list[$i][$j]; - $messenger->{((sizeof($email_list[$i]) == 1) ? 'to' : 'bcc')}($email_row['email'], $email_row['name']); + $messenger->{((count($email_list[$i]) == 1) ? 'to' : 'bcc')}($email_row['email'], $email_row['name']); $messenger->im($email_row['jabber'], $email_row['name']); } @@ -322,8 +322,8 @@ class acp_email $s_priority_options .= ''; $template_data = array( - 'S_WARNING' => (sizeof($error)) ? true : false, - 'WARNING_MSG' => (sizeof($error)) ? implode('
    ', $error) : '', + 'S_WARNING' => (count($error)) ? true : false, + 'WARNING_MSG' => (count($error)) ? implode('
    ', $error) : '', 'U_ACTION' => $this->u_action, 'S_GROUP_OPTIONS' => $select_list, 'USERNAMES' => implode("\n", $usernames), diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 66bb630241..cf01ff2489 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -90,7 +90,7 @@ class acp_forums $errors = $this->delete_forum($forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id); - if (sizeof($errors)) + if (count($errors)) { break; } @@ -198,7 +198,7 @@ class acp_forums $errors = $this->update_forum_data($forum_data); - if (!sizeof($errors)) + if (!count($errors)) { $forum_perm_from = $request->variable('forum_perm_from', 0); $cache->destroy('sql', FORUMS_TABLE); @@ -622,7 +622,7 @@ class acp_forums $template_data = array( 'S_EDIT_FORUM' => true, - 'S_ERROR' => (sizeof($errors)) ? true : false, + 'S_ERROR' => (count($errors)) ? true : false, 'S_PARENT_ID' => $this->parent_id, 'S_FORUM_PARENT_ID' => $forum_data['parent_id'], 'S_ADD_ACTION' => ($action == 'add') ? true : false, @@ -632,7 +632,7 @@ class acp_forums 'L_COPY_PERMISSIONS_EXPLAIN' => $user->lang['COPY_PERMISSIONS_' . strtoupper($action) . '_EXPLAIN'], 'L_TITLE' => $user->lang[$this->page_title], - 'ERROR_MSG' => (sizeof($errors)) ? implode('
    ', $errors) : '', + 'ERROR_MSG' => (count($errors)) ? implode('
    ', $errors) : '', 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_DATA_LINK' => $forum_data['forum_link'], @@ -772,8 +772,8 @@ class acp_forums 'S_FORUM_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false, 'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false, 'S_FORUMS_LIST' => $forums_list, - 'S_ERROR' => (sizeof($errors)) ? true : false, - 'ERROR_MSG' => (sizeof($errors)) ? implode('
    ', $errors) : '') + 'S_ERROR' => (count($errors)) ? true : false, + 'ERROR_MSG' => (count($errors)) ? implode('
    ', $errors) : '') ); return; @@ -924,7 +924,7 @@ class acp_forums unset($rowset); $template->assign_vars(array( - 'ERROR_MSG' => (sizeof($errors)) ? implode('
    ', $errors) : '', + 'ERROR_MSG' => (count($errors)) ? implode('
    ', $errors) : '', 'NAVIGATION' => $navigation, 'FORUM_BOX' => $forum_box, 'U_SEL_ACTION' => $this->u_action, @@ -1053,7 +1053,7 @@ class acp_forums // What are we going to do tonight Brain? The same thing we do everynight, // try to take over the world ... or decide whether to continue update // and if so, whether it's a new forum/cat/link or an existing one - if (sizeof($errors)) + if (count($errors)) { return $errors; } @@ -1217,12 +1217,12 @@ class acp_forums $errors = array_merge($errors, $this->delete_forum_content($_row['forum_id'])); } - if (sizeof($errors)) + if (count($errors)) { return $errors; } - if (sizeof($forum_ids)) + if (count($forum_ids)) { $sql = 'DELETE FROM ' . FORUMS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_ids); @@ -1252,7 +1252,7 @@ class acp_forums $allowed_forums = array_diff($allowed_forums, $forum_ids); $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . " - SET allowed_forums = '" . ((sizeof($allowed_forums)) ? serialize($allowed_forums) : '') . "' + SET allowed_forums = '" . ((count($allowed_forums)) ? serialize($allowed_forums) : '') . "' WHERE group_id = {$_row['group_id']}"; $db->sql_query($sql); } @@ -1321,7 +1321,7 @@ class acp_forums $forum_data_sql['forum_last_poster_colour'] = ''; } - if (sizeof($errors)) + if (count($errors)) { return $errors; } @@ -1338,7 +1338,7 @@ class acp_forums } } - if (sizeof($errors)) + if (count($errors)) { return $errors; } @@ -1433,10 +1433,10 @@ class acp_forums $moved_forums = get_forum_branch($from_id, 'children', 'descending'); $from_data = $moved_forums[0]; - $diff = sizeof($moved_forums) * 2; + $diff = count($moved_forums) * 2; $moved_ids = array(); - for ($i = 0, $size = sizeof($moved_forums); $i < $size; ++$i) + for ($i = 0, $size = count($moved_forums); $i < $size; ++$i) { $moved_ids[] = $moved_forums[$i]['forum_id']; } @@ -1612,7 +1612,7 @@ class acp_forums } } - if (sizeof($errors)) + if (count($errors)) { return $errors; } @@ -1628,12 +1628,12 @@ class acp_forums $errors = array_merge($errors, $this->delete_forum_content($row['forum_id'])); } - if (sizeof($errors)) + if (count($errors)) { return $errors; } - $diff = sizeof($forum_ids) * 2; + $diff = count($forum_ids) * 2; $sql = 'DELETE FROM ' . FORUMS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_ids); @@ -1706,7 +1706,7 @@ class acp_forums } } - if (sizeof($errors)) + if (count($errors)) { return $errors; } @@ -1754,7 +1754,7 @@ class acp_forums $allowed_forums = array_diff($allowed_forums, $forum_ids); $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . " - SET allowed_forums = '" . ((sizeof($allowed_forums)) ? serialize($allowed_forums) : '') . "' + SET allowed_forums = '" . ((count($allowed_forums)) ? serialize($allowed_forums) : '') . "' WHERE group_id = {$row['group_id']}"; $db->sql_query($sql); } @@ -1927,9 +1927,9 @@ class acp_forums } $db->sql_freeresult($result); - if (sizeof($ids)) + if (count($ids)) { - $start += sizeof($ids); + $start += count($ids); foreach ($tables as $table) { @@ -1937,7 +1937,7 @@ class acp_forums } } } - while (sizeof($ids) == $batch_size); + while (count($ids) == $batch_size); } unset($ids); @@ -1978,7 +1978,7 @@ class acp_forums } // Adjust users post counts - if (sizeof($post_counts)) + if (count($post_counts)) { foreach ($post_counts as $poster_id => $substract) { @@ -2062,7 +2062,7 @@ class acp_forums } $db->sql_freeresult($result); - if (!sizeof($target)) + if (!count($target)) { // The forum is already on top or bottom return false; diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 305296d013..70ae9876f4 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -187,7 +187,7 @@ class acp_groups group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row); - $start = (sizeof($mark_ary) < 200) ? 0 : $start + 200; + $start = (count($mark_ary) < 200) ? 0 : $start + 200; } else { @@ -486,7 +486,7 @@ class acp_groups $error = array_merge($error, $validation_error); } - if (!sizeof($error)) + if (!count($error)) { // Only set the rank, colour, etc. if it's changed or if we're adding a new // group. This prevents existing group members being updated if no changes @@ -614,7 +614,7 @@ class acp_groups } } - if (sizeof($error)) + if (count($error)) { $error = array_map(array(&$user, 'lang'), $error); $group_rank = $submit_ary['rank']; @@ -732,12 +732,12 @@ class acp_groups 'S_ADD_GROUP' => ($action == 'add') ? true : false, 'S_GROUP_PERM' => ($action == 'add' && $auth->acl_get('a_authgroups') && $auth->acl_gets('a_aauth', 'a_fauth', 'a_mauth', 'a_uauth')) ? true : false, 'S_INCLUDE_SWATCH' => true, - 'S_ERROR' => (sizeof($error)) ? true : false, + 'S_ERROR' => (count($error)) ? true : false, 'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false, 'S_USER_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), - 'ERROR_MSG' => (sizeof($error)) ? implode('
    ', $error) : '', + 'ERROR_MSG' => (count($error)) ? implode('
    ', $error) : '', 'GROUP_NAME' => $group_helper->get_name($group_name), 'GROUP_INTERNAL_NAME' => $group_name, 'GROUP_DESC' => $group_desc_data['text'], diff --git a/phpBB/includes/acp/acp_help_phpbb.php b/phpBB/includes/acp/acp_help_phpbb.php index 7991a0dad6..a36b36eddc 100644 --- a/phpBB/includes/acp/acp_help_phpbb.php +++ b/phpBB/includes/acp/acp_help_phpbb.php @@ -48,7 +48,7 @@ class acp_help_phpbb $error[] = $user->lang['FORM_INVALID']; } // Do not write values if there is an error - if (sizeof($error)) + if (count($error)) { $submit = false; } diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 6cd5386857..2c3948f644 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -166,7 +166,7 @@ class acp_icons } $db->sql_freeresult($result); - if (sizeof($smilies)) + if (count($smilies)) { foreach ($smilies as $row) { @@ -301,7 +301,7 @@ class acp_icons } // Ok, another row for adding an addition code for a pre-existing image... - if ($action == 'add' && $mode == 'smilies' && sizeof($smilies)) + if ($action == 'add' && $mode == 'smilies' && count($smilies)) { $template->assign_vars(array( 'S_ADD_CODE' => true, @@ -378,7 +378,7 @@ class acp_icons { $smiley_count = $this->item_count($table); - $addable_smileys_count = sizeof($images); + $addable_smileys_count = count($images); foreach ($images as $image) { if (!isset($image_add[$image])) @@ -546,8 +546,8 @@ class acp_icons { if (preg_match_all("#'(.*?)', ?#", $pak_entry, $data)) { - if ((sizeof($data[1]) != 4 && $mode == 'icons') || - ((sizeof($data[1]) != 6 || (empty($data[1][4]) || empty($data[1][5]))) && $mode == 'smilies' )) + if ((count($data[1]) != 4 && $mode == 'icons') || + ((count($data[1]) != 6 || (empty($data[1][4]) || empty($data[1][5]))) && $mode == 'smilies' )) { trigger_error($user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -605,7 +605,7 @@ class acp_icons if ($mode == 'smilies') { $smiley_count = $this->item_count($table); - if ($smiley_count + sizeof($pak_ary) > SMILEY_LIMIT) + if ($smiley_count + count($pak_ary) > SMILEY_LIMIT) { trigger_error($user->lang('TOO_MANY_SMILIES', SMILEY_LIMIT) . adm_back_link($this->u_action), E_USER_WARNING); } @@ -616,8 +616,8 @@ class acp_icons $data = array(); if (preg_match_all("#'(.*?)', ?#", $pak_entry, $data)) { - if ((sizeof($data[1]) != 4 && $mode == 'icons') || - (sizeof($data[1]) != 6 && $mode == 'smilies')) + if ((count($data[1]) != 4 && $mode == 'icons') || + (count($data[1]) != 6 && $mode == 'smilies')) { trigger_error($user->lang['WRONG_PAK_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); } diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index ec256e93ef..6026f44ede 100644 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -70,7 +70,7 @@ class acp_inactive $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); - if ($submit && sizeof($mark)) + if ($submit && count($mark)) { if ($action !== 'delete' && !check_form_key($form_key)) { diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 4baff921b6..68afe32d60 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -402,7 +402,7 @@ class acp_language unset($installed); - if (sizeof($new_ary)) + if (count($new_ary)) { foreach ($new_ary as $iso => $lang_ary) { diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index c33ca8c4fc..8c3fb66a70 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -57,7 +57,7 @@ class acp_logs { $conditions = array(); - if ($deletemark && sizeof($marked)) + if ($deletemark && count($marked)) { $conditions['log_id'] = array('IN' => $marked); } @@ -167,7 +167,7 @@ class acp_logs 'IP' => $row['ip'], 'DATE' => $user->format_date($row['time']), 'ACTION' => $row['action'], - 'DATA' => (sizeof($data)) ? implode(' | ', $data) : '', + 'DATA' => (count($data)) ? implode(' | ', $data) : '', 'ID' => $row['id'], ) ); diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 9b1a248923..4efa8c70b3 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -337,7 +337,7 @@ class acp_main } unset($posted); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary); } diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index 4d90b2da8b..fb0c09055e 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -249,7 +249,7 @@ class acp_modules trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } - if (!sizeof($errors)) + if (!count($errors)) { $module_manager->remove_cache_file($this->module_class); @@ -364,7 +364,7 @@ class acp_modules trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } - if (!sizeof($errors)) + if (!count($errors)) { $module_manager->remove_cache_file($this->module_class); @@ -430,7 +430,7 @@ class acp_modules array_change_key_case($module_data, CASE_UPPER)) ); - if (sizeof($errors)) + if (count($errors)) { $template->assign_vars(array( 'S_ERROR' => true, @@ -444,7 +444,7 @@ class acp_modules } // Default management page - if (sizeof($errors)) + if (count($errors)) { if ($request->is_ajax()) { diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index 0bfe67830f..80cad9915d 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -348,7 +348,7 @@ class acp_permission_roles { $hold_ary = $this->auth_admin->get_role_mask($role_id); - if (sizeof($hold_ary)) + if (count($hold_ary)) { $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; @@ -496,7 +496,7 @@ class acp_permission_roles $content_array = $content_array[0]; - $template->assign_var('S_NUM_PERM_COLS', sizeof($categories)); + $template->assign_var('S_NUM_PERM_COLS', count($categories)); // Assign to template foreach ($content_array as $cat => $cat_array) diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 12c43bf94c..8e05b95849 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -131,11 +131,11 @@ class acp_permissions } unset($usernames); - if (sizeof($username) && !sizeof($user_id)) + if (count($username) && !count($user_id)) { user_get_id_name($user_id, $username); - if (!sizeof($user_id)) + if (!count($user_id)) { trigger_error($user->lang['SELECTED_USER_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -260,17 +260,17 @@ class acp_permissions { $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type); - if ($all_users && sizeof($items['user_ids'])) + if ($all_users && count($items['user_ids'])) { $user_id = $items['user_ids']; } - else if ($all_groups && sizeof($items['group_ids'])) + else if ($all_groups && count($items['group_ids'])) { $group_id = $items['group_ids']; } } - if (sizeof($user_id) || sizeof($group_id)) + if (count($user_id) || count($group_id)) { $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id); } @@ -349,7 +349,7 @@ class acp_permissions { case 'forum_dropdown': - if (sizeof($forum_id)) + if (count($forum_id)) { $this->check_existence('forum', $forum_id); continue 2; @@ -364,7 +364,7 @@ class acp_permissions case 'forums': - if (sizeof($forum_id)) + if (count($forum_id)) { $this->check_existence('forum', $forum_id); continue 2; @@ -394,7 +394,7 @@ class acp_permissions case 'user': - if (sizeof($user_id)) + if (count($user_id)) { $this->check_existence('user', $user_id); continue 2; @@ -409,7 +409,7 @@ class acp_permissions case 'group': - if (sizeof($group_id)) + if (count($group_id)) { $this->check_existence('group', $group_id); continue 2; @@ -428,14 +428,14 @@ class acp_permissions $all_users = (isset($_POST['all_users'])) ? true : false; $all_groups = (isset($_POST['all_groups'])) ? true : false; - if ((sizeof($user_id) && !$all_users) || (sizeof($group_id) && !$all_groups)) + if ((count($user_id) && !$all_users) || (count($group_id) && !$all_groups)) { - if (sizeof($user_id)) + if (count($user_id)) { $this->check_existence('user', $user_id); } - if (sizeof($group_id)) + if (count($group_id)) { $this->check_existence('group', $group_id); } @@ -446,13 +446,13 @@ class acp_permissions // Now we check the users... because the "all"-selection is different here (all defined users/groups) $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type); - if ($all_users && sizeof($items['user_ids'])) + if ($all_users && count($items['user_ids'])) { $user_id = $items['user_ids']; continue 2; } - if ($all_groups && sizeof($items['group_ids'])) + if ($all_groups && count($items['group_ids'])) { $group_id = $items['group_ids']; continue 2; @@ -487,14 +487,14 @@ class acp_permissions 'ANONYMOUS_USER_ID' => ANONYMOUS, 'S_SELECT_VICTIM' => true, - 'S_ALLOW_ALL_SELECT' => (sizeof($forum_id) > 5) ? false : true, + 'S_ALLOW_ALL_SELECT' => (count($forum_id) > 5) ? false : true, 'S_CAN_SELECT_USER' => ($auth->acl_get('a_authusers')) ? true : false, 'S_CAN_SELECT_GROUP' => ($auth->acl_get('a_authgroups')) ? true : false, 'S_HIDDEN_FIELDS' => $s_hidden_fields) ); // Let the forum names being displayed - if (sizeof($forum_id)) + if (count($forum_id)) { $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . ' @@ -510,7 +510,7 @@ class acp_permissions $db->sql_freeresult($result); $template->assign_vars(array( - 'S_FORUM_NAMES' => (sizeof($forum_names)) ? true : false, + 'S_FORUM_NAMES' => (count($forum_names)) ? true : false, 'FORUM_NAMES' => implode($user->lang['COMMA_SEPARATOR'], $forum_names)) ); } @@ -527,13 +527,13 @@ class acp_permissions )); // Do not allow forum_ids being set and no other setting defined (will bog down the server too much) - if (sizeof($forum_id) && !sizeof($user_id) && !sizeof($group_id)) + if (count($forum_id) && !count($user_id) && !count($group_id)) { trigger_error($user->lang['ONLY_FORUM_DEFINED'] . adm_back_link($this->u_action), E_USER_WARNING); } $template->assign_vars(array( - 'S_PERMISSION_DROPDOWN' => (sizeof($this->permission_dropdown) > 1) ? $this->build_permission_dropdown($this->permission_dropdown, $permission_type, $permission_scope) : false, + 'S_PERMISSION_DROPDOWN' => (count($this->permission_dropdown) > 1) ? $this->build_permission_dropdown($this->permission_dropdown, $permission_type, $permission_scope) : false, 'L_PERMISSION_TYPE' => $this->permissions->get_type_lang($permission_type), 'U_ACTION' => $this->u_action, @@ -546,8 +546,8 @@ class acp_permissions 'S_SETTING_PERMISSIONS' => true) ); - $hold_ary = $auth_admin->get_mask('set', (sizeof($user_id)) ? $user_id : false, (sizeof($group_id)) ? $group_id : false, (sizeof($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NO); - $auth_admin->display_mask('set', $permission_type, $hold_ary, ((sizeof($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false)); + $hold_ary = $auth_admin->get_mask('set', (count($user_id)) ? $user_id : false, (count($group_id)) ? $group_id : false, (count($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NO); + $auth_admin->display_mask('set', $permission_type, $hold_ary, ((count($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false)); } else { @@ -555,8 +555,8 @@ class acp_permissions 'S_VIEWING_PERMISSIONS' => true) ); - $hold_ary = $auth_admin->get_mask('view', (sizeof($user_id)) ? $user_id : false, (sizeof($group_id)) ? $group_id : false, (sizeof($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NEVER); - $auth_admin->display_mask('view', $permission_type, $hold_ary, ((sizeof($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false)); + $hold_ary = $auth_admin->get_mask('view', (count($user_id)) ? $user_id : false, (count($group_id)) ? $group_id : false, (count($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NEVER); + $auth_admin->display_mask('view', $permission_type, $hold_ary, ((count($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false)); } } @@ -652,7 +652,7 @@ class acp_permissions break; } - if (sizeof($ids)) + if (count($ids)) { $sql = "SELECT $sql_id FROM $table @@ -667,7 +667,7 @@ class acp_permissions $db->sql_freeresult($result); } - if (!sizeof($ids)) + if (!count($ids)) { trigger_error($user->lang['SELECTED_' . strtoupper($mode) . '_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -684,7 +684,7 @@ class acp_permissions $psubmit = $request->variable('psubmit', array(0 => array(0 => 0))); // User or group to be set? - $ug_type = (sizeof($user_id)) ? 'user' : 'group'; + $ug_type = (count($user_id)) ? 'user' : 'group'; // Check the permission setting again if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) @@ -715,7 +715,7 @@ class acp_permissions $ug_id = array($ug_id); $forum_id = array($forum_id); - if (sizeof($inherit)) + if (count($inherit)) { foreach ($inherit as $_ug_id => $forum_id_ary) { @@ -771,7 +771,7 @@ class acp_permissions global $request; // User or group to be set? - $ug_type = (sizeof($user_id)) ? 'user' : 'group'; + $ug_type = (count($user_id)) ? 'user' : 'group'; // Check the permission setting again if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) @@ -870,7 +870,7 @@ class acp_permissions } } - if (sizeof(array_diff_assoc($auth_settings, $test_auth_settings))) + if (count(array_diff_assoc($auth_settings, $test_auth_settings))) { return false; } @@ -886,7 +886,7 @@ class acp_permissions global $user, $db, $cache, $auth; // User or group to be set? - $ug_type = (sizeof($user_id)) ? 'user' : 'group'; + $ug_type = (count($user_id)) ? 'user' : 'group'; // Check the permission setting again if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) @@ -895,7 +895,7 @@ class acp_permissions trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } - $auth_admin->acl_delete($ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : false), $permission_type); + $auth_admin->acl_delete($ug_type, (($ug_type == 'user') ? $user_id : $group_id), (count($forum_id) ? $forum_id : false), $permission_type); // Do we need to recache the moderator lists? if ($permission_type == 'm_') @@ -903,7 +903,7 @@ class acp_permissions phpbb_cache_moderators($db, $cache, $auth); } - $this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : array(0 => 0))); + $this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (count($forum_id) ? $forum_id : array(0 => 0))); if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') { @@ -1053,7 +1053,7 @@ class acp_permissions $total = ACL_NO; $add_key = (($forum_id) ? '_LOCAL' : ''); - if (sizeof($groups)) + if (count($groups)) { // Get group auth settings $hold_ary = $auth->acl_group_raw_data(array_keys($groups), $permission, $forum_id); @@ -1099,7 +1099,7 @@ class acp_permissions // Get user specific permission... globally or for this forum $hold_ary = $auth->acl_user_raw_data($user_id, $permission, $forum_id); - $auth_setting = (!sizeof($hold_ary)) ? ACL_NO : $hold_ary[$user_id][$forum_id][$permission]; + $auth_setting = (!count($hold_ary)) ? ACL_NO : $hold_ary[$user_id][$forum_id][$permission]; switch ($auth_setting) { @@ -1258,7 +1258,7 @@ class acp_permissions /** @var \phpbb\group\helper $group_helper */ $group_helper = $phpbb_container->get('group_helper'); - $sql_forum_id = ($permission_scope == 'global') ? 'AND a.forum_id = 0' : ((sizeof($forum_id)) ? 'AND ' . $db->sql_in_set('a.forum_id', $forum_id) : 'AND a.forum_id <> 0'); + $sql_forum_id = ($permission_scope == 'global') ? 'AND a.forum_id = 0' : ((count($forum_id)) ? 'AND ' . $db->sql_in_set('a.forum_id', $forum_id) : 'AND a.forum_id <> 0'); // Permission options are only able to be a permission set... therefore we will pre-fetch the possible options and also the possible roles $option_ids = $role_ids = array(); @@ -1274,7 +1274,7 @@ class acp_permissions } $db->sql_freeresult($result); - if (sizeof($option_ids)) + if (count($option_ids)) { $sql = 'SELECT DISTINCT role_id FROM ' . ACL_ROLES_DATA_TABLE . ' @@ -1288,15 +1288,15 @@ class acp_permissions $db->sql_freeresult($result); } - if (sizeof($option_ids) && sizeof($role_ids)) + if (count($option_ids) && count($role_ids)) { $sql_where = 'AND (' . $db->sql_in_set('a.auth_option_id', $option_ids) . ' OR ' . $db->sql_in_set('a.auth_role_id', $role_ids) . ')'; } - else if (sizeof($role_ids)) + else if (count($role_ids)) { $sql_where = 'AND ' . $db->sql_in_set('a.auth_role_id', $role_ids); } - else if (sizeof($option_ids)) + else if (count($option_ids)) { $sql_where = 'AND ' . $db->sql_in_set('a.auth_option_id', $option_ids); } diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 18dde382ca..f8b42b917e 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -446,7 +446,7 @@ class acp_profile { $exploded_options = (is_array($options)) ? $options : explode("\n", $options); - if (sizeof($exploded_options) == sizeof($lang_options) || $action == 'create') + if (count($exploded_options) == count($lang_options) || $action == 'create') { // The number of options in the field is equal to the number of options already in the database // Or we are creating a new dropdown list. @@ -567,7 +567,7 @@ class acp_profile } } - if (sizeof($error)) + if (count($error)) { $submit = false; } @@ -600,9 +600,9 @@ class acp_profile $s_hidden_fields .= build_hidden_fields($_new_key_ary); } - if (!sizeof($error)) + if (!count($error)) { - if (($step == 3 && (sizeof($this->lang_defs['iso']) == 1 || $save)) || ($action == 'edit' && $save)) + if (($step == 3 && (count($this->lang_defs['iso']) == 1 || $save)) || ($action == 'edit' && $save)) { if (!check_form_key($form_key)) { @@ -616,7 +616,7 @@ class acp_profile $template->assign_vars(array( 'S_EDIT' => true, 'S_EDIT_MODE' => ($action == 'edit') ? true : false, - 'ERROR_MSG' => (sizeof($error)) ? implode('
    ', $error) : '', + 'ERROR_MSG' => (count($error)) ? implode('
    ', $error) : '', 'L_TITLE' => $user->lang['STEP_' . $step . '_TITLE_' . strtoupper($action)], 'L_EXPLAIN' => $user->lang['STEP_' . $step . '_EXPLAIN_' . strtoupper($action)], @@ -664,7 +664,7 @@ class acp_profile $template->assign_vars(array( 'S_STEP_TWO' => true, - 'L_NEXT_STEP' => (sizeof($this->lang_defs['iso']) == 1) ? $user->lang['SAVE'] : $user->lang['PROFILE_LANG_OPTIONS']) + 'L_NEXT_STEP' => (count($this->lang_defs['iso']) == 1) ? $user->lang['SAVE'] : $user->lang['PROFILE_LANG_OPTIONS']) ); // Build options based on profile type @@ -750,7 +750,7 @@ class acp_profile $active_value = (!$row['field_active']) ? 'activate' : 'deactivate'; $id = $row['field_id']; - $s_need_edit = (sizeof($this->lang_defs['diff'][$row['field_id']])) ? true : false; + $s_need_edit = (count($this->lang_defs['diff'][$row['field_id']])) ? true : false; if ($s_need_edit) { @@ -1011,7 +1011,7 @@ class acp_profile $this->update_insert(PROFILE_LANG_TABLE, $sql_ary, array('field_id' => $field_id, 'lang_id' => $default_lang_id)); } - if (is_array($cp->vars['l_lang_name']) && sizeof($cp->vars['l_lang_name'])) + if (is_array($cp->vars['l_lang_name']) && count($cp->vars['l_lang_name'])) { foreach ($cp->vars['l_lang_name'] as $lang_id => $data) { @@ -1087,7 +1087,7 @@ class acp_profile } } - if (is_array($cp->vars['l_lang_options']) && sizeof($cp->vars['l_lang_options'])) + if (is_array($cp->vars['l_lang_options']) && count($cp->vars['l_lang_options'])) { $empty_lang = array(); @@ -1098,7 +1098,7 @@ class acp_profile $lang_ary = explode("\n", $lang_ary); } - if (sizeof($lang_ary) != sizeof($cp->vars['lang_options'])) + if (count($lang_ary) != count($cp->vars['lang_options'])) { $empty_lang[$lang_id] = true; } @@ -1150,7 +1150,7 @@ class acp_profile } } - if (sizeof($profile_lang_fields)) + if (count($profile_lang_fields)) { foreach ($profile_lang_fields as $sql) { @@ -1213,7 +1213,7 @@ class acp_profile $where_sql[] = $key . ' = ' . ((is_string($value)) ? "'" . $db->sql_escape($value) . "'" : (int) $value); } - if (!sizeof($where_sql)) + if (!count($where_sql)) { return; } @@ -1229,14 +1229,14 @@ class acp_profile { $sql_ary = array_merge($where_fields, $sql_ary); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql_ary)); } } else { - if (sizeof($sql_ary)) + if (count($sql_ary)) { $sql = "UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE ' . implode(' AND ', $where_sql); diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php index d37050869a..687a68d9fa 100644 --- a/phpBB/includes/acp/acp_prune.php +++ b/phpBB/includes/acp/acp_prune.php @@ -97,7 +97,7 @@ class acp_prune 'S_PRUNED' => true) ); - $sql_forum = (sizeof($forum_id)) ? ' AND ' . $db->sql_in_set('forum_id', $forum_id) : ''; + $sql_forum = (count($forum_id)) ? ' AND ' . $db->sql_in_set('forum_id', $forum_id) : ''; // Get a list of forum's or the data for the forum that we are pruning. $sql = 'SELECT forum_id, forum_name @@ -183,7 +183,7 @@ class acp_prune // If they haven't selected a forum for pruning yet then // display a select box to use for pruning. - if (!sizeof($forum_id)) + if (!count($forum_id)) { $template->assign_vars(array( 'U_ACTION' => $this->u_action, @@ -215,7 +215,7 @@ class acp_prune $db->sql_freeresult($result); - $l_selected_forums = (sizeof($forum_id) == 1) ? 'SELECTED_FORUM' : 'SELECTED_FORUMS'; + $l_selected_forums = (count($forum_id) == 1) ? 'SELECTED_FORUM' : 'SELECTED_FORUMS'; $template->assign_vars(array( 'L_SELECTED_FORUMS' => $user->lang[$l_selected_forums], @@ -252,7 +252,7 @@ class acp_prune $user_ids = $usernames = array(); $this->get_prune_users($user_ids, $usernames); - if (sizeof($user_ids)) + if (count($user_ids)) { if ($action == 'deactivate') { @@ -291,7 +291,7 @@ class acp_prune $user_ids = $usernames = array(); $this->get_prune_users($user_ids, $usernames); - if (!sizeof($user_ids)) + if (!count($user_ids)) { trigger_error($user->lang['USER_PRUNE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -434,7 +434,7 @@ class acp_prune } // implicit else when both arrays are empty do nothing - if ((sizeof($active) && sizeof($active) != 3) || (sizeof($joined_before) && sizeof($joined_before) != 3) || (sizeof($joined_after) && sizeof($joined_after) != 3)) + if ((count($active) && count($active) != 3) || (count($joined_before) && count($joined_before) != 3) || (count($joined_after) && count($joined_after) != 3)) { trigger_error($user->lang['WRONG_ACTIVE_JOINED_DATE'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -448,15 +448,15 @@ class acp_prune $where_sql .= ($count !== false) ? " AND user_posts " . $key_match[$count_select] . ' ' . (int) $count . ' ' : ''; // First handle pruning of users who never logged in, last active date is 0000-00-00 - if (sizeof($active) && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0) + if (count($active) && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0) { $where_sql .= ' AND user_lastvisit = 0'; } - else if (sizeof($active) && $active_select != 'lt') + else if (count($active) && $active_select != 'lt') { $where_sql .= ' AND user_lastvisit ' . $key_match[$active_select] . ' ' . gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]); } - else if (sizeof($active)) + else if (count($active)) { $where_sql .= ' AND (user_lastvisit > 0 AND user_lastvisit < ' . gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]) . ')'; } diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php index 51c398681d..dfb2ccbfd3 100644 --- a/phpBB/includes/acp/acp_reasons.php +++ b/phpBB/includes/acp/acp_reasons.php @@ -103,7 +103,7 @@ class acp_reasons } } - if (!sizeof($error)) + if (!count($error)) { // New reason? if ($action == 'add') @@ -171,7 +171,7 @@ class acp_reasons 'L_TITLE' => $user->lang['REASON_' . $l_title], 'U_ACTION' => $this->u_action . "&id=$reason_id&action=$action", 'U_BACK' => $this->u_action, - 'ERROR_MSG' => (sizeof($error)) ? implode('
    ', $error) : '', + 'ERROR_MSG' => (count($error)) ? implode('
    ', $error) : '', 'REASON_TITLE' => $reason_row['reason_title'], 'REASON_DESCRIPTION' => $reason_row['reason_description'], @@ -182,7 +182,7 @@ class acp_reasons 'S_AVAILABLE_TITLES' => implode($user->lang['COMMA_SEPARATOR'], array_map('htmlspecialchars', array_keys($user->lang['report_reasons']['TITLE']))), 'S_EDIT_REASON' => true, 'S_TRANSLATED' => $translated, - 'S_ERROR' => (sizeof($error)) ? true : false, + 'S_ERROR' => (count($error)) ? true : false, ) ); diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index a792ee6b79..8cad7c927c 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -332,9 +332,9 @@ class acp_search $forum_ids[] = $row['forum_id']; } $db->sql_freeresult($result); - $row_count += sizeof($ids); + $row_count += count($ids); - if (sizeof($ids)) + if (count($ids)) { $this->search->index_remove($ids, $posters, $forum_ids); } @@ -474,8 +474,8 @@ class acp_search $statistics = array(); foreach ($data as $statistic => $value) { - $n = sizeof($statistics); - if ($n && sizeof($statistics[$n - 1]) < 3) + $n = count($statistics); + if ($n && count($statistics[$n - 1]) < 3) { $statistics[$n - 1] += array('statistic_2' => $statistic, 'value_2' => $value); } @@ -492,7 +492,7 @@ class acp_search 'S_ACTIVE' => ($type == $config['search_type']) ? true : false, 'S_HIDDEN_FIELDS' => build_hidden_fields(array('search_type' => $type)), 'S_INDEXED' => (bool) $search->index_created(), - 'S_STATS' => (bool) sizeof($statistics)) + 'S_STATS' => (bool) count($statistics)) ); foreach ($statistics as $statistic) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 5a2b1445dc..7a7d9b591c 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -690,7 +690,7 @@ class acp_users } $db->sql_freeresult($result); - if (sizeof($topic_id_ary)) + if (count($topic_id_ary)) { $sql = 'SELECT topic_id, forum_id, topic_title, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_attachment FROM ' . TOPICS_TABLE . ' @@ -718,12 +718,12 @@ class acp_users } // Entire topic comprises posts by this user, move these topics - if (sizeof($move_topic_ary)) + if (count($move_topic_ary)) { move_topics($move_topic_ary, $new_forum_id, false); } - if (sizeof($move_post_ary)) + if (count($move_post_ary)) { // Create new topic // Update post_ids, report_ids, attachment_ids @@ -769,13 +769,13 @@ class acp_users $forum_id_ary = array_unique($forum_id_ary); $topic_id_ary = array_unique(array_merge(array_keys($topic_id_ary), $new_topic_id_ary)); - if (sizeof($topic_id_ary)) + if (count($topic_id_ary)) { sync('topic_reported', 'topic_id', $topic_id_ary); sync('topic', 'topic_id', $topic_id_ary); } - if (sizeof($forum_id_ary)) + if (count($forum_id_ary)) { sync('forum', 'forum_id', $forum_id_ary, false, true); } @@ -886,7 +886,7 @@ class acp_users $update_password = $data['new_password'] && !$passwords_manager->check($data['new_password'], $user_row['user_password']); $update_email = ($data['email'] != $user_row['user_email']) ? $data['email'] : false; - if (!sizeof($error)) + if (!count($error)) { $sql_ary = array(); @@ -988,7 +988,7 @@ class acp_users )); } - if (sizeof($sql_ary)) + if (count($sql_ary)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' @@ -1341,7 +1341,7 @@ class acp_users { $s_hidden_fields['delall'] = 1; } - if (isset($_POST['delall']) || (isset($_POST['delmarked']) && sizeof($marked))) + if (isset($_POST['delall']) || (isset($_POST['delmarked']) && count($marked))) { confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); } @@ -1377,9 +1377,9 @@ class acp_users { // Check if there are more occurrences of % than arguments, if there are we fill out the arguments array // It doesn't matter if we add more arguments than placeholders - if ((substr_count($row['action'], '%') - sizeof($log_data_ary)) > 0) + if ((substr_count($row['action'], '%') - count($log_data_ary)) > 0) { - $log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($row['action'], '%') - sizeof($log_data_ary), '')); + $log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($row['action'], '%') - count($log_data_ary), '')); } $row['action'] = vsprintf($row['action'], $log_data_ary); $row['action'] = bbcode_nl2br(censor_text($row['action'])); @@ -1472,7 +1472,7 @@ class acp_users // validate custom profile fields $cp->submit_cp_field('profile', $user_row['iso_lang_id'], $cp_data, $cp_error); - if (sizeof($cp_error)) + if (count($cp_error)) { $error = array_merge($error, $cp_error); } @@ -1493,7 +1493,7 @@ class acp_users $vars = array('submit', 'data', 'error'); extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_validate', compact($vars))); - if (!sizeof($error)) + if (!count($error)) { $sql_ary = array( 'user_jabber' => $data['jabber'], @@ -1637,7 +1637,7 @@ class acp_users $error[] = 'FORM_INVALID'; } - if (!sizeof($error)) + if (!count($error)) { $this->optionset($user_row, 'viewimg', $data['view_images']); $this->optionset($user_row, 'viewflash', $data['view_flash']); @@ -1688,7 +1688,7 @@ class acp_users $vars = array('data', 'user_row', 'sql_ary', 'error'); extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_sql', compact($vars))); - if (!sizeof($error)) + if (!count($error)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " @@ -2052,7 +2052,7 @@ class acp_users 'sig' ); - if (sizeof($warn_msg)) + if (count($warn_msg)) { $error += $warn_msg; } @@ -2064,7 +2064,7 @@ class acp_users } else { - if (!sizeof($error)) + if (!count($error)) { $this->optionset($user_row, 'sig_bbcode', $enable_bbcode); $this->optionset($user_row, 'sig_smilies', $enable_smilies); @@ -2139,7 +2139,7 @@ class acp_users $sort_key = $request->variable('sk', 'a'); $sort_dir = $request->variable('sd', 'd'); - if ($deletemark && sizeof($marked)) + if ($deletemark && count($marked)) { $sql = 'SELECT attach_id FROM ' . ATTACHMENTS_TABLE . ' @@ -2156,7 +2156,7 @@ class acp_users $db->sql_freeresult($result); } - if ($deletemark && sizeof($marked)) + if ($deletemark && count($marked)) { if (confirm_box(true)) { @@ -2177,7 +2177,7 @@ class acp_users $attachment_manager->delete('attach', $marked); unset($attachment_manager); - $message = (sizeof($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; + $message = (count($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACHMENTS_DELETED', false, array(implode($user->lang['COMMA_SEPARATOR'], $log_attachments))); trigger_error($message . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -2447,7 +2447,7 @@ class acp_users // Select box for other groups $sql = 'SELECT group_id, group_name, group_type, group_founder_manage FROM ' . GROUPS_TABLE . ' - ' . ((sizeof($id_ary)) ? 'WHERE ' . $db->sql_in_set('group_id', $id_ary, true) : '') . ' + ' . ((count($id_ary)) ? 'WHERE ' . $db->sql_in_set('group_id', $id_ary, true) : '') . ' ORDER BY group_type DESC, group_name ASC'; $result = $db->sql_query($sql); @@ -2580,8 +2580,8 @@ class acp_users // Assign general variables $template->assign_vars(array( - 'S_ERROR' => (sizeof($error)) ? true : false, - 'ERROR_MSG' => (sizeof($error)) ? implode('
    ', $error) : '') + 'S_ERROR' => (count($error)) ? true : false, + 'ERROR_MSG' => (count($error)) ? implode('
    ', $error) : '') ); } diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index b36b900396..58da3b922f 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -107,7 +107,7 @@ class auth_admin extends \phpbb\auth\auth $compare_options = array_diff(preg_replace('/^((?!' . $auth_option . ').+)|(' . $auth_option . ')$/', '', array_keys($this->acl_options[$scope])), array('')); // If forum_ids is false and the scope is local we actually want to have all forums within the array - if ($scope == 'local' && !sizeof($forum_ids)) + if ($scope == 'local' && !count($forum_ids)) { $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE; @@ -177,9 +177,9 @@ class auth_admin extends \phpbb\auth\auth // Now, we need to fill the gaps with $acl_fill. ;) // Now switch back to keys - if (sizeof($compare_options)) + if (count($compare_options)) { - $compare_options = array_combine($compare_options, array_fill(1, sizeof($compare_options), $acl_fill)); + $compare_options = array_combine($compare_options, array_fill(1, count($compare_options), $acl_fill)); } // Defining the user-function here to save some memory @@ -189,7 +189,7 @@ class auth_admin extends \phpbb\auth\auth }; // Actually fill the gaps - if (sizeof($hold_ary)) + if (count($hold_ary)) { foreach ($hold_ary as $ug_id => $row) { @@ -356,7 +356,7 @@ class auth_admin extends \phpbb\auth\auth // Build js roles array (role data assignments) $s_role_js_array = ''; - if (sizeof($roles)) + if (count($roles)) { $s_role_js_array = array(); @@ -422,7 +422,7 @@ class auth_admin extends \phpbb\auth\auth // If we only have one forum id to display or being in local mode and more than one user/group to display, // we switch the complete interface to group by user/usergroup instead of grouping by forum // To achieve this, we need to switch the array a bit - if (sizeof($forum_ids) == 1 || ($local && sizeof($ug_names_ary) > 1)) + if (count($forum_ids) == 1 || ($local && count($ug_names_ary) > 1)) { $hold_ary_temp = $hold_ary; $hold_ary = array(); @@ -453,9 +453,9 @@ class auth_admin extends \phpbb\auth\auth 'S_LOCAL' => ($local) ? true : false, 'S_GLOBAL' => (!$local) ? true : false, - 'S_NUM_CATS' => sizeof($categories), + 'S_NUM_CATS' => count($categories), 'S_VIEW' => ($mode == 'view') ? true : false, - 'S_NUM_OBJECTS' => sizeof($content_array), + 'S_NUM_OBJECTS' => count($content_array), 'S_USER_MODE' => ($user_mode == 'user') ? true : false, 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false) ); @@ -546,15 +546,15 @@ class auth_admin extends \phpbb\auth\auth 'NAME' => $ug_name, 'CATEGORIES' => implode('
'; } @@ -672,8 +672,8 @@ class diff_renderer_side_by_side extends diff_renderer case 'change': // Pop the old/new stacks one by one, until both are empty. - $oldsize = sizeof($change['old']); - $newsize = sizeof($change['new']); + $oldsize = count($change['old']); + $newsize = count($change['new']); $left = $right = ''; for ($row = 0, $row_max = max($oldsize, $newsize); $row < $row_max; ++$row) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index d62c7a21b3..7c077265a9 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -931,7 +931,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = $where_ids = array_map('intval', $where_ids); /* Possible code for splitting post deletion - if (sizeof($where_ids) >= 1001) + if (count($where_ids) >= 1001) { // Split into chunks of 1000 $chunks = array_chunk($where_ids, 1000); diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index 910708f502..77e03ee449 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -409,7 +409,7 @@ class compress_zip extends compress function close() { // Write out central file directory and footer ... if it exists - if (sizeof($this->ctrl_dir)) + if (count($this->ctrl_dir)) { fwrite($this->fp, $this->file()); } @@ -511,8 +511,8 @@ class compress_zip extends compress $ctrldir = implode('', $this->ctrl_dir); return $ctrldir . $this->eof_cdh . - pack('v', sizeof($this->ctrl_dir)) . // total # of entries "on this disk" - pack('v', sizeof($this->ctrl_dir)) . // total # of entries overall + pack('v', count($this->ctrl_dir)) . // total # of entries "on this disk" + pack('v', count($this->ctrl_dir)) . // total # of entries overall pack('V', strlen($ctrldir)) . // size of central dir pack('V', $this->datasec_len) . // offset to start of central dir "\x00\x00"; // .zip file comment length diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index c3e7a7ceb7..2763fbce6c 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -336,7 +336,7 @@ function get_context($text, $words, $length = 400) $text = str_replace($entities, $characters, $text); $word_indizes = array(); - if (sizeof($words)) + if (count($words)) { $match = ''; // find the starting indizes of all words @@ -361,12 +361,12 @@ function get_context($text, $words, $length = 400) } unset($match); - if (sizeof($word_indizes)) + if (count($word_indizes)) { $word_indizes = array_unique($word_indizes); sort($word_indizes); - $wordnum = sizeof($word_indizes); + $wordnum = count($word_indizes); // number of characters on the right and left side of each word $sequence_length = (int) ($length / (2 * $wordnum)) - 2; $final_text = ''; @@ -434,7 +434,7 @@ function get_context($text, $words, $length = 400) } } - if (!sizeof($words) || !sizeof($word_indizes)) + if (!count($words) || !count($word_indizes)) { return str_replace($characters, $entities, ((utf8_strlen($text) >= $length + 3) ? utf8_substr($text, 0, $length) . '...' : $text)); } @@ -1013,7 +1013,7 @@ function censor_text($text) } } - if (sizeof($censors)) + if (count($censors)) { return preg_replace($censors['match'], $censors['replace'], $text); } @@ -1071,7 +1071,7 @@ function smiley_text($text, $force_option = false) */ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_ary, $preview = false) { - if (!sizeof($attachments)) + if (!count($attachments)) { return; } @@ -1106,7 +1106,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_a } // Grab attachments (security precaution) - if (sizeof($attach_ids)) + if (count($attach_ids)) { global $db; @@ -1143,7 +1143,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_a foreach ($attachments as $attachment) { - if (!sizeof($attachment)) + if (!count($attachment)) { continue; } @@ -1435,7 +1435,7 @@ function truncate_string($string, $max_length = 60, $max_store_length = 255, $al $chars = array_map('utf8_htmlspecialchars', $_chars); // Now check the length ;) - if (sizeof($chars) > $max_length) + if (count($chars) > $max_length) { // Cut off the last elements from the array $string = implode('', array_slice($chars, 0, $max_length - utf8_strlen($append))); @@ -1643,7 +1643,7 @@ function phpbb_generate_string_list($items, $user) return ''; } - $count = sizeof($items); + $count = count($items); $last_item = array_pop($items); $lang_key = 'STRING_LIST_MULTI'; diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 176e3dd6de..4a8f664fe9 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -192,7 +192,7 @@ function get_group_id($group_name) $db->sql_freeresult($result); } - if (!sizeof($group_mapping)) + if (!count($group_mapping)) { add_default_groups(); return get_group_id($group_name); @@ -307,7 +307,7 @@ function decode_ip($int_ip) $hexipbang = explode('.', chunk_split($int_ip, 2, '.')); // Any mod changing the way ips are stored? Then we are not able to convert and enter the ip "as is" to not "destroy" anything... - if (sizeof($hexipbang) < 4) + if (count($hexipbang) < 4) { return $int_ip; } @@ -479,7 +479,7 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false $dir->close(); } - for ($i = 0, $end = sizeof($dirlist); $i < $end; ++$i) + for ($i = 0, $end = count($dirlist); $i < $end; ++$i) { $dir = $dirlist[$i]; @@ -1261,7 +1261,7 @@ function get_config() } } - if (!sizeof($convert_config)) + if (!count($convert_config)) { $convert->p_master->error($user->lang['CONV_ERROR_CONFIG_EMPTY'], __LINE__, __FILE__); } @@ -1406,9 +1406,9 @@ function get_path($src_path, $src_url, $test_file) $url_parts = explode('/', $m[2]); if (substr($src_url, -1) != '/') { - if (preg_match('/.*\.([a-z0-9]{3,4})$/i', $url_parts[sizeof($url_parts) - 1])) + if (preg_match('/.*\.([a-z0-9]{3,4})$/i', $url_parts[count($url_parts) - 1])) { - $url_parts[sizeof($url_parts) - 1] = ''; + $url_parts[count($url_parts) - 1] = ''; } else { @@ -1425,9 +1425,9 @@ function get_path($src_path, $src_url, $test_file) $path_array = array(); $phpbb_parts = explode('/', $script_path); - for ($i = 0, $end = sizeof($url_parts); $i < $end; ++$i) + for ($i = 0, $end = count($url_parts); $i < $end; ++$i) { - if ($i < sizeof($phpbb_parts[$i]) && $url_parts[$i] == $phpbb_parts[$i]) + if ($i < count($phpbb_parts[$i]) && $url_parts[$i] == $phpbb_parts[$i]) { $path_array[] = $url_parts[$i]; unset($url_parts[$i]); @@ -1435,7 +1435,7 @@ function get_path($src_path, $src_url, $test_file) else { $path = ''; - for ($j = $i, $end2 = sizeof($phpbb_parts); $j < $end2; ++$j) + for ($j = $i, $end2 = count($phpbb_parts); $j < $end2; ++$j) { $path .= '../'; } @@ -1458,7 +1458,7 @@ function get_path($src_path, $src_url, $test_file) function compare_table($tables, $tablename, &$prefixes) { - for ($i = 0, $table_size = sizeof($tables); $i < $table_size; ++$i) + for ($i = 0, $table_size = count($tables); $i < $table_size; ++$i) { if (preg_match('/(.*)' . $tables[$i] . '$/', $tablename, $m)) { @@ -1754,7 +1754,7 @@ function add_default_groups() ); } - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(GROUPS_TABLE, $sql_ary); } @@ -1786,7 +1786,7 @@ function add_groups_to_teampage() } $db->sql_freeresult($result); - if (sizeof($teampage_ary)) + if (count($teampage_ary)) { $db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_ary); } @@ -2101,7 +2101,7 @@ function update_topics_posted() } unset($posted); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary); } @@ -2136,7 +2136,7 @@ function fix_empty_primary_groups() } $db->sql_freeresult($result); - if (sizeof($user_ids)) + if (count($user_ids)) { $db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('administrators') . ' WHERE group_id = 0 AND ' . $db->sql_in_set('user_id', $user_ids)); @@ -2152,7 +2152,7 @@ function fix_empty_primary_groups() } $db->sql_freeresult($result); - if (sizeof($user_ids)) + if (count($user_ids)) { $db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('global_moderators') . ' WHERE group_id = 0 AND ' . $db->sql_in_set('user_id', $user_ids)); @@ -2264,7 +2264,7 @@ function convert_bbcode($message, $convert_size = true, $extended_bbcodes = fals "\n\n" ); - for ($i = 0, $end = sizeof($str_from); $i < $end; ++$i) + for ($i = 0, $end = count($str_from); $i < $end; ++$i) { $origx[] = '#\\' . str_replace(']', '\\]', $str_from[$i]) . '#is'; $replx[] = $str_to[$i]; @@ -2273,7 +2273,7 @@ function convert_bbcode($message, $convert_size = true, $extended_bbcodes = fals if (preg_match_all('#\[email=([^\]]+)\](.*?)\[/email\]#i', $message, $m)) { - for ($i = 0, $end = sizeof($m[1]); $i < $end; ++$i) + for ($i = 0, $end = count($m[1]); $i < $end; ++$i) { if ($m[1][$i] == $m[2][$i]) { @@ -2292,7 +2292,7 @@ function convert_bbcode($message, $convert_size = true, $extended_bbcodes = fals $message = preg_replace('#\[size=([0-9]+)\](.*?)\[/size\]#i', '[size=\1]\2[/size]', $message); $message = preg_replace('#\[size=[0-9]{2,}\](.*?)\[/size\]#i', '[size=29]\1[/size]', $message); - for ($i = sizeof($size); $i;) + for ($i = count($size); $i;) { $i--; $message = str_replace('[size=' . $i . ']', '[size=' . $size[$i] . ']', $message); @@ -2335,9 +2335,9 @@ function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $sour $path = $phpbb_root_path; $parts = explode('/', $trg); - unset($parts[sizeof($parts) - 1]); + unset($parts[count($parts) - 1]); - for ($i = 0, $end = sizeof($parts); $i < $end; ++$i) + for ($i = 0, $end = count($parts); $i < $end; ++$i) { $path .= $parts[$i] . '/'; @@ -2437,7 +2437,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_ if ($copy_subdirs) { - for ($i = 0, $end = sizeof($dirlist); $i < $end; ++$i) + for ($i = 0, $end = count($dirlist); $i < $end; ++$i) { $dir = $dirlist[$i]; @@ -2458,21 +2458,21 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_ $bad_dirs[] = $trg_path . $dir; } - if (!sizeof($bad_dirs)) + if (!count($bad_dirs)) { copy_dir($src . $dir, $trg . $dir, true, $overwrite, $die_on_failure, $source_relative_path); } } } - if (sizeof($bad_dirs)) + if (count($bad_dirs)) { - $str = (sizeof($bad_dirs) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE']; + $str = (count($bad_dirs) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE']; sort($bad_dirs); $convert->p_master->error(sprintf($str, implode('
', $bad_dirs)), __LINE__, __FILE__); } - for ($i = 0, $end = sizeof($filelist); $i < $end; ++$i) + for ($i = 0, $end = count($filelist); $i < $end; ++$i) { copy_file($src . $filelist[$i], $trg . $filelist[$i], $overwrite, $die_on_failure, $source_relative_path); } diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 69bfa89c93..8621c91d82 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -506,7 +506,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } } - $l_subforums = (sizeof($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS']; + $l_subforums = (count($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS']; $folder_image = ($forum_unread) ? 'forum_unread_subforum' : 'forum_read_subforum'; } else @@ -558,7 +558,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $l_moderator = $moderators_list = ''; if ($display_moderators && !empty($forum_moderators[$forum_id])) { - $l_moderator = (sizeof($forum_moderators[$forum_id]) == 1) ? $user->lang['MODERATOR'] : $user->lang['MODERATORS']; + $l_moderator = (count($forum_moderators[$forum_id]) == 1) ? $user->lang['MODERATOR'] : $user->lang['MODERATORS']; $moderators_list = implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]); } @@ -605,7 +605,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'S_AUTH_READ' => $auth->acl_get('f_read', $row['forum_id']), 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, - 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false, + 'S_SUBFORUMS' => (count($subforums_list)) ? true : false, 'S_DISPLAY_SUBJECT' => ($last_post_subject !== '' && $config['display_last_subject']) ? true : false, 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false, @@ -1634,10 +1634,10 @@ function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabl ($data['user_type'] != USER_INACTIVE || $data['user_inactive_reason'] != INACTIVE_MANUAL) && // They must be able to read PMs - sizeof($auth->acl_get_list($user_id, 'u_readpm')) && + count($auth->acl_get_list($user_id, 'u_readpm')) && // They must not be permanently banned - !sizeof(phpbb_get_banned_user_ids($user_id, false)) && + !count(phpbb_get_banned_user_ids($user_id, false)) && // They must allow users to contact via PM (($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) || $data['user_allow_pm']) diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index e00be1e01a..cee7c39035 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -568,7 +568,7 @@ function phpbb_parse_range_request($request_array, $filesize) $range = explode('-', trim($range_string)); // "-" is invalid, "0-0" however is valid and means the very first byte. - if (sizeof($range) != 2 || $range[0] === '' && $range[1] === '') + if (count($range) != 2 || $range[0] === '' && $range[1] === '') { continue; } diff --git a/phpBB/includes/functions_jabber.php b/phpBB/includes/functions_jabber.php index cfe8c2a90e..cf0865e608 100644 --- a/phpBB/includes/functions_jabber.php +++ b/phpBB/includes/functions_jabber.php @@ -207,7 +207,7 @@ class jabber */ function login() { - if (!sizeof($this->features)) + if (!count($this->features)) { $this->add_to_log('Error: No feature information from server available.'); return false; @@ -293,7 +293,7 @@ class jabber */ function get_log() { - if ($this->enable_logging && sizeof($this->log_array)) + if ($this->enable_logging && count($this->log_array)) { return implode("

", $this->log_array); } @@ -400,14 +400,14 @@ class jabber */ function response($xml) { - if (!is_array($xml) || !sizeof($xml)) + if (!is_array($xml) || !count($xml)) { return false; } // did we get multiple elements? do one after another // array('message' => ..., 'presence' => ...) - if (sizeof($xml) > 1) + if (count($xml) > 1) { foreach ($xml as $key => $value) { @@ -419,7 +419,7 @@ class jabber { // or even multiple elements of the same type? // array('message' => array(0 => ..., 1 => ...)) - if (sizeof(reset($xml)) > 1) + if (count(reset($xml)) > 1) { foreach (reset($xml) as $value) { @@ -858,14 +858,14 @@ class jabber array_push($children, $vals[$i]['value']); } - while (++$i < sizeof($vals)) + while (++$i < count($vals)) { switch ($vals[$i]['type']) { case 'open': $tagname = (isset($vals[$i]['tag'])) ? $vals[$i]['tag'] : ''; - $size = (isset($children[$tagname])) ? sizeof($children[$tagname]) : 0; + $size = (isset($children[$tagname])) ? count($children[$tagname]) : 0; if (isset($vals[$i]['attributes'])) { @@ -883,7 +883,7 @@ class jabber case 'complete': $tagname = $vals[$i]['tag']; - $size = (isset($children[$tagname])) ? sizeof($children[$tagname]) : 0; + $size = (isset($children[$tagname])) ? count($children[$tagname]) : 0; $children[$tagname][$size]['#'] = (isset($vals[$i]['value'])) ? $vals[$i]['value'] : array(); if (isset($vals[$i]['attributes'])) diff --git a/phpBB/includes/functions_mcp.php b/phpBB/includes/functions_mcp.php index dfe3fefbd0..468a6e899d 100644 --- a/phpBB/includes/functions_mcp.php +++ b/phpBB/includes/functions_mcp.php @@ -113,7 +113,7 @@ function phpbb_get_topic_data($topic_ids, $acl_list = false, $read_tracking = fa $topics = array(); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { return array(); } @@ -130,7 +130,7 @@ function phpbb_get_topic_data($topic_ids, $acl_list = false, $read_tracking = fa $cache_topic_ids = array(); } - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql_array = array( 'SELECT' => 't.*, f.*', @@ -201,7 +201,7 @@ function phpbb_get_post_data($post_ids, $acl_list = false, $read_tracking = fals $rowset = array(); - if (!sizeof($post_ids)) + if (!count($post_ids)) { return array(); } @@ -280,7 +280,7 @@ function phpbb_get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = $forum_id = array($forum_id); } - if (!sizeof($forum_id)) + if (!count($forum_id)) { return array(); } @@ -329,7 +329,7 @@ function phpbb_get_pm_data($pm_ids) $rowset = array(); - if (!sizeof($pm_ids)) + if (!count($pm_ids)) { return array(); } @@ -730,7 +730,7 @@ function phpbb_check_ids(&$ids, $table, $sql_id, $acl_list = false, $single_foru } $db->sql_freeresult($result); - if (!sizeof($ids)) + if (!count($ids)) { return false; } diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index ab7f00a65a..0b8c32c8bd 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -84,7 +84,7 @@ class messenger return; } - $pos = isset($this->addresses['to']) ? sizeof($this->addresses['to']) : 0; + $pos = isset($this->addresses['to']) ? count($this->addresses['to']) : 0; $this->addresses['to'][$pos]['email'] = trim($address); @@ -109,7 +109,7 @@ class messenger return; } - $pos = isset($this->addresses['cc']) ? sizeof($this->addresses['cc']) : 0; + $pos = isset($this->addresses['cc']) ? count($this->addresses['cc']) : 0; $this->addresses['cc'][$pos]['email'] = trim($address); $this->addresses['cc'][$pos]['name'] = trim($realname); } @@ -124,7 +124,7 @@ class messenger return; } - $pos = isset($this->addresses['bcc']) ? sizeof($this->addresses['bcc']) : 0; + $pos = isset($this->addresses['bcc']) ? count($this->addresses['bcc']) : 0; $this->addresses['bcc'][$pos]['email'] = trim($address); $this->addresses['bcc'][$pos]['name'] = trim($realname); } @@ -140,7 +140,7 @@ class messenger return; } - $pos = isset($this->addresses['im']) ? sizeof($this->addresses['im']) : 0; + $pos = isset($this->addresses['im']) ? count($this->addresses['im']) : 0; $this->addresses['im'][$pos]['uid'] = trim($address); $this->addresses['im'][$pos]['name'] = trim($realname); } @@ -503,7 +503,7 @@ class messenger $vars = array('headers'); extract($phpbb_dispatcher->trigger_event('core.modify_email_headers', compact($vars))); - if (sizeof($this->extra_headers)) + if (count($this->extra_headers)) { $headers = array_merge($headers, $this->extra_headers); } @@ -814,7 +814,7 @@ class queue } $package_size = $data_ary['package_size']; - $num_items = (!$package_size || sizeof($data_ary['data']) < $package_size) ? sizeof($data_ary['data']) : $package_size; + $num_items = (!$package_size || count($data_ary['data']) < $package_size) ? count($data_ary['data']) : $package_size; /* * This code is commented out because it causes problems on some web hosts. @@ -823,9 +823,9 @@ class queue * web host and the package size setting is wrong. // If the amount of emails to be sent is way more than package_size than we need to increase it to prevent backlogs... - if (sizeof($data_ary['data']) > $package_size * 2.5) + if (count($data_ary['data']) > $package_size * 2.5) { - $num_items = sizeof($data_ary['data']); + $num_items = count($data_ary['data']); } */ @@ -914,7 +914,7 @@ class queue } // No more data for this object? Unset it - if (!sizeof($this->queue_data[$object]['data'])) + if (!count($this->queue_data[$object]['data'])) { unset($this->queue_data[$object]); } @@ -930,7 +930,7 @@ class queue } } - if (!sizeof($this->queue_data)) + if (!count($this->queue_data)) { @unlink($this->cache_file); } @@ -965,7 +965,7 @@ class queue */ function save() { - if (!sizeof($this->data)) + if (!count($this->data)) { return; } @@ -979,7 +979,7 @@ class queue foreach ($this->queue_data as $object => $data_ary) { - if (isset($this->data[$object]) && sizeof($this->data[$object])) + if (isset($this->data[$object]) && count($this->data[$object])) { $this->data[$object]['data'] = array_merge($data_ary['data'], $this->data[$object]['data']); } @@ -1067,7 +1067,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) $mail_rcpt = $mail_to = $mail_cc = array(); // Build correct addresses for RCPT TO command and the client side display (TO, CC) - if (isset($addresses['to']) && sizeof($addresses['to'])) + if (isset($addresses['to']) && count($addresses['to'])) { foreach ($addresses['to'] as $which_ary) { @@ -1076,7 +1076,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) } } - if (isset($addresses['bcc']) && sizeof($addresses['bcc'])) + if (isset($addresses['bcc']) && count($addresses['bcc'])) { foreach ($addresses['bcc'] as $which_ary) { @@ -1084,7 +1084,7 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) } } - if (isset($addresses['cc']) && sizeof($addresses['cc'])) + if (isset($addresses['cc']) && count($addresses['cc'])) { foreach ($addresses['cc'] as $which_ary) { @@ -1802,11 +1802,11 @@ function mail_encode($str, $eol = "\r\n") $array = utf8_str_split($str); $str = ''; - while (sizeof($array)) + while (count($array)) { $text = ''; - while (sizeof($array) && intval((strlen($text . $array[0]) + 2) / 3) << 2 <= $split_length) + while (count($array) && intval((strlen($text . $array[0]) + 2) / 3) << 2 <= $split_length) { $text .= array_shift($array); } diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index c55b46dc5c..9cc6fc23a6 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -243,7 +243,7 @@ class p_master } } - $depth = sizeof($this->module_cache['parents'][$row['module_id']]); + $depth = count($this->module_cache['parents'][$row['module_id']]); // We need to prefix the functions to not create a naming conflict @@ -279,7 +279,7 @@ class p_master 'parent' => (int) $row['parent_id'], 'cat' => ($row['right_id'] > $row['left_id'] + 1) ? true : false, - 'is_duplicate' => ($row['module_basename'] && sizeof($names[$row['module_basename'] . '_' . $row['module_mode']]) > 1) ? true : false, + 'is_duplicate' => ($row['module_basename'] && count($names[$row['module_basename'] . '_' . $row['module_mode']]) > 1) ? true : false, 'name' => (string) $row['module_basename'], 'mode' => (string) $row['module_mode'], @@ -431,7 +431,7 @@ class p_master extract($phpbb_dispatcher->trigger_event('core.module_auth', compact($vars))); $tokens = $match[0]; - for ($i = 0, $size = sizeof($tokens); $i < $size; $i++) + for ($i = 0, $size = count($tokens); $i < $size; $i++) { $token = &$tokens[$i]; diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index d899cdb745..1319fd49cd 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -114,7 +114,7 @@ function generate_smilies($mode, $forum_id) } $db->sql_freeresult($result); - if (sizeof($smilies)) + if (count($smilies)) { $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path(); @@ -200,7 +200,7 @@ function update_post_information($type, $ids, $return_update_sql = false) $topic_condition = ''; } - if (sizeof($ids) == 1) + if (count($ids) == 1) { $sql = 'SELECT MAX(p.post_id) as last_post_id FROM ' . POSTS_TABLE . " p $topic_join @@ -222,7 +222,7 @@ function update_post_information($type, $ids, $return_update_sql = false) $last_post_ids = array(); while ($row = $db->sql_fetchrow($result)) { - if (sizeof($ids) == 1) + if (count($ids) == 1) { $row[$type . '_id'] = $ids[0]; } @@ -256,7 +256,7 @@ function update_post_information($type, $ids, $return_update_sql = false) } } - if (sizeof($last_post_ids)) + if (count($last_post_ids)) { $sql = 'SELECT p.' . $type . '_id, p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u @@ -277,7 +277,7 @@ function update_post_information($type, $ids, $return_update_sql = false) } unset($empty_forums, $ids, $last_post_ids); - if ($return_update_sql || !sizeof($update_sql)) + if ($return_update_sql || !count($update_sql)) { return $update_sql; } @@ -310,7 +310,7 @@ function posting_gen_topic_icons($mode, $icon_id) $template->assign_var('S_NO_ICON_CHECKED', ' checked="checked"'); } - if (sizeof($icons)) + if (count($icons)) { $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path; @@ -662,7 +662,7 @@ function posting_gen_inline_attachments(&$attachment_data) { global $template; - if (sizeof($attachment_data)) + if (count($attachment_data)) { $s_inline_attachment_options = ''; @@ -689,12 +689,12 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a // Some default template variables $template->assign_vars(array( 'S_SHOW_ATTACH_BOX' => $show_attach_box, - 'S_HAS_ATTACHMENTS' => sizeof($attachment_data), + 'S_HAS_ATTACHMENTS' => count($attachment_data), 'FILESIZE' => $config['max_filesize'], 'FILE_COMMENT' => (isset($filename_data['filecomment'])) ? $filename_data['filecomment'] : '', )); - if (sizeof($attachment_data)) + if (count($attachment_data)) { // We display the posted attachments within the desired order. ($config['display_order']) ? krsort($attachment_data) : ksort($attachment_data); @@ -726,7 +726,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a } } - return sizeof($attachment_data); + return count($attachment_data); } // @@ -774,13 +774,13 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms } $db->sql_freeresult($result); - if (!sizeof($draft_rows)) + if (!count($draft_rows)) { return; } $topic_rows = array(); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql = 'SELECT topic_id, forum_id, topic_title, topic_poster FROM ' . TOPICS_TABLE . ' @@ -893,7 +893,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $db->sql_freeresult($result); - if (!sizeof($post_list)) + if (!count($post_list)) { return false; } @@ -988,7 +988,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id ); extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_post_list', compact($vars))); - for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) + for ($i = 0, $end = count($post_list); $i < $end; ++$i) { // A non-existing rowset only happens if there was no user present for the entered poster_id // This could be a broken posts table. @@ -1215,7 +1215,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ foreach ($shadow_forum_ids as $updated_forum => $topic_count) { - // counting is fun! we only have to do sizeof($forum_ids) number of queries, + // counting is fun! we only have to do count($forum_ids) number of queries, // even if the topic is moved back to where its shadow lives (we count how many times it is in a forum) $sql = 'UPDATE ' . FORUMS_TABLE . ' SET forum_topics_approved = forum_topics_approved - ' . $topic_count . ' @@ -1235,7 +1235,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ $phpbb_content_visibility->remove_topic_from_statistic($data, $sql_data); $update_sql = update_post_information('forum', $forum_id, true); - if (sizeof($update_sql)) + if (count($update_sql)) { $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : ''; $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]); @@ -1284,7 +1284,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ { // Update last post information when hard deleting. Soft delete already did that by itself. $update_sql = update_post_information('forum', $forum_id, true); - if (sizeof($update_sql)) + if (count($update_sql)) { $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . implode(', ', $update_sql[$forum_id]); } @@ -1926,7 +1926,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data $sql_insert_ary = array(); - for ($i = 0, $size = sizeof($poll_ary['poll_options']); $i < $size; $i++) + for ($i = 0, $size = count($poll_ary['poll_options']); $i < $size; $i++) { if (strlen(trim($poll_ary['poll_options'][$i]))) { @@ -1934,7 +1934,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data { // If we add options we need to put them to the end to be able to preserve votes... $sql_insert_ary[] = array( - 'poll_option_id' => (int) sizeof($cur_poll_options) + 1 + sizeof($sql_insert_ary), + 'poll_option_id' => (int) count($cur_poll_options) + 1 + count($sql_insert_ary), 'topic_id' => (int) $data_ary['topic_id'], 'poll_option_text' => (string) $poll_ary['poll_options'][$i] ); @@ -1952,16 +1952,16 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data $db->sql_multi_insert(POLL_OPTIONS_TABLE, $sql_insert_ary); - if (sizeof($poll_ary['poll_options']) < sizeof($cur_poll_options)) + if (count($poll_ary['poll_options']) < count($cur_poll_options)) { $sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . ' - WHERE poll_option_id > ' . sizeof($poll_ary['poll_options']) . ' + WHERE poll_option_id > ' . count($poll_ary['poll_options']) . ' AND topic_id = ' . $data_ary['topic_id']; $db->sql_query($sql); } // If edited, we would need to reset votes (since options can be re-ordered above, you can't be sure if the change is for changing the text or adding an option - if ($mode == 'edit' && sizeof($poll_ary['poll_options']) != sizeof($cur_poll_options)) + if ($mode == 'edit' && count($poll_ary['poll_options']) != count($cur_poll_options)) { $db->sql_query('DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . $data_ary['topic_id']); $db->sql_query('UPDATE ' . POLL_OPTIONS_TABLE . ' SET poll_option_total = 0 WHERE topic_id = ' . $data_ary['topic_id']); @@ -1979,7 +1979,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data $orphan_rows[(int) $attach_row['attach_id']] = array(); } - if (sizeof($orphan_rows)) + if (count($orphan_rows)) { $sql = 'SELECT attach_id, filesize, physical_filename FROM ' . ATTACHMENTS_TABLE . ' diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index ff962075a8..444bf2c7e0 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -466,7 +466,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) $user_rules = $db->sql_fetchrowset($result); $db->sql_freeresult($result); - if (sizeof($user_rules)) + if (count($user_rules)) { $sql = 'SELECT zebra_id, friend, foe FROM ' . ZEBRA_TABLE . " @@ -499,7 +499,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) $db->sql_freeresult($result); // Retrieve user memberships - if (sizeof($user_ids)) + if (count($user_ids)) { $sql = 'SELECT * FROM ' . USER_GROUP_TABLE . ' @@ -600,14 +600,14 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // only gone through if new messages arrive. // Delete messages - if (sizeof($delete_ids)) + if (count($delete_ids)) { - $num_removed += sizeof($delete_ids); + $num_removed += count($delete_ids); delete_pm($user_id, $delete_ids, PRIVMSGS_NO_BOX); } // Set messages to Unread - if (sizeof($unread_ids)) + if (count($unread_ids)) { $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' SET pm_unread = 0 @@ -618,7 +618,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } // mark messages as important - if (sizeof($important_ids)) + if (count($important_ids)) { $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' SET pm_marked = 1 - pm_marked @@ -631,7 +631,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // Move into folder $folder = array(); - if (sizeof($move_into_folder)) + if (count($move_into_folder)) { // Determine Full Folder Action - we need the move to folder id later eventually $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; @@ -676,12 +676,12 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) // Check Message Limit - we calculate with the complete array, most of the time it is one message // But we are making sure that the other way around works too (more messages in queue than allowed to be stored) - if ($user->data['message_limit'] && $folder[$folder_id] && ($folder[$folder_id] + sizeof($msg_ary)) > $user->data['message_limit']) + if ($user->data['message_limit'] && $folder[$folder_id] && ($folder[$folder_id] + count($msg_ary)) > $user->data['message_limit']) { $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; // If destination folder itself is full... - if ($full_folder_action >= 0 && ($folder[$full_folder_action] + sizeof($msg_ary)) > $user->data['message_limit']) + if ($full_folder_action >= 0 && ($folder[$full_folder_action] + count($msg_ary)) > $user->data['message_limit']) { $full_folder_action = $config['full_folder_action'] - (FULL_FOLDER_NONE*(-1)); } @@ -699,7 +699,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) WHERE user_id = $user_id AND folder_id = $dest_folder ORDER BY msg_id ASC"; - $result = $db->sql_query_limit($sql, (($folder[$dest_folder] + sizeof($msg_ary)) - $user->data['message_limit'])); + $result = $db->sql_query_limit($sql, (($folder[$dest_folder] + count($msg_ary)) - $user->data['message_limit'])); $delete_ids = array(); while ($row = $db->sql_fetchrow($result)) @@ -708,7 +708,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } $db->sql_freeresult($result); - $num_removed += sizeof($delete_ids); + $num_removed += count($delete_ids); delete_pm($user_id, $delete_ids, $dest_folder); } } @@ -744,7 +744,7 @@ function place_pm_into_folder(&$global_privmsgs_rules, $release = false) } } - if (sizeof($action_ary)) + if (count($action_ary)) { // Move from OUTBOX to SENTBOX // We are not checking any full folder status here... SENTBOX is a special treatment (old messages get deleted) @@ -785,7 +785,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol $move_msg_ids = array($move_msg_ids); } - if (sizeof($move_msg_ids) && !in_array($dest_folder, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) && + if (count($move_msg_ids) && !in_array($dest_folder, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) && !in_array($cur_folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)) && $cur_folder_id != $dest_folder) { // We have to check the destination folder ;) @@ -805,7 +805,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol trigger_error('NOT_AUTHORISED'); } - if ($message_limit && $row['pm_count'] + sizeof($move_msg_ids) > $message_limit) + if ($message_limit && $row['pm_count'] + count($move_msg_ids) > $message_limit) { $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $row['folder_name']) . '

'; $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $row['folder_name']); @@ -822,7 +822,7 @@ function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_fol $num_messages = (int) $db->sql_fetchfield('num_messages'); $db->sql_freeresult($result); - if ($message_limit && $num_messages + sizeof($move_msg_ids) > $message_limit) + if ($message_limit && $num_messages + count($move_msg_ids) > $message_limit) { $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $user->lang['PM_INBOX']) . '

'; $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user->lang['PM_INBOX']); @@ -949,7 +949,7 @@ function handle_mark_actions($user_id, $mark_action) $msg_ids = $request->variable('marked_msg_id', array(0)); $cur_folder_id = $request->variable('cur_folder_id', PRIVMSGS_NO_BOX); - if (!sizeof($msg_ids)) + if (!count($msg_ids)) { return false; } @@ -981,7 +981,7 @@ function handle_mark_actions($user_id, $mark_action) { delete_pm($user_id, $msg_ids, $cur_folder_id); - $success_msg = (sizeof($msg_ids) == 1) ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED'; + $success_msg = (count($msg_ids) == 1) ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED'; $redirect = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $cur_folder_id); meta_refresh(3, $redirect); @@ -1032,7 +1032,7 @@ function delete_pm($user_id, $msg_ids, $folder_id) $msg_ids = array($msg_ids); } - if (!sizeof($msg_ids)) + if (!count($msg_ids)) { return false; } @@ -1069,7 +1069,7 @@ function delete_pm($user_id, $msg_ids, $folder_id) $db->sql_freeresult($result); unset($msg_ids); - if (!sizeof($delete_rows)) + if (!count($delete_rows)) { return false; } @@ -1156,7 +1156,7 @@ function delete_pm($user_id, $msg_ids, $folder_id) $delete_ids = array_keys($delete_rows); - if (sizeof($delete_ids)) + if (count($delete_ids)) { // Check if there are any attachments we need to remove /** @var \phpbb\attachment\manager $attachment_manager */ @@ -1289,7 +1289,7 @@ function phpbb_delete_users_pms($user_ids) $num_pms = (int) $row['num_undelivered_privmsgs']; $undelivered_user[$num_pms][] = (int) $row['user_id']; - if (sizeof($undelivered_user[$num_pms]) > 50) + if (count($undelivered_user[$num_pms]) > 50) { // If there are too many users affected the query might get // too long, so we update the value for the first bunch here. @@ -1416,7 +1416,7 @@ function rebuild_header($check_ary) $_types = array('u', 'g'); foreach ($_types as $type) { - if (sizeof(${$type})) + if (count(${$type})) { foreach (${$type} as $id) { @@ -1461,7 +1461,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) } $address = array(); - if (sizeof($u)) + if (count($u)) { $sql = 'SELECT user_id, username, user_colour FROM ' . USERS_TABLE . ' @@ -1485,7 +1485,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) $db->sql_freeresult($result); } - if (sizeof($g)) + if (count($g)) { if ($plaintext) { @@ -1532,7 +1532,7 @@ function write_pm_addresses($check_ary, $author_id, $plaintext = false) } } - if (sizeof($address) && !$plaintext) + if (count($address) && !$plaintext) { $template->assign_var('S_' . strtoupper($check_type) . '_RECIPIENT', true); @@ -1651,7 +1651,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) $_types = array('u', 'g'); foreach ($_types as $ug_type) { - if (isset($data_ary['address_list'][$ug_type]) && sizeof($data_ary['address_list'][$ug_type])) + if (isset($data_ary['address_list'][$ug_type]) && count($data_ary['address_list'][$ug_type])) { foreach ($data_ary['address_list'][$ug_type] as $id => $field) { @@ -1673,7 +1673,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) } } - if (isset($data_ary['address_list']['g']) && sizeof($data_ary['address_list']['g'])) + if (isset($data_ary['address_list']['g']) && count($data_ary['address_list']['g'])) { // We need to check the PM status of group members (do they want to receive PM's?) // Only check if not a moderator or admin, since they are allowed to override this user setting @@ -1696,7 +1696,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) $db->sql_freeresult($result); } - if (!sizeof($recipients)) + if (!count($recipients)) { trigger_error('NO_RECIPIENT'); } @@ -1764,7 +1764,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) break; } - if (sizeof($sql_data)) + if (count($sql_data)) { if ($mode == 'post' || $mode == 'reply' || $mode == 'quote' || $mode == 'quotepost' || $mode == 'forward') { @@ -1844,7 +1844,7 @@ function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) $orphan_rows[(int) $attach_row['attach_id']] = array(); } - if (sizeof($orphan_rows)) + if (count($orphan_rows)) { $sql = 'SELECT attach_id, filesize, physical_filename FROM ' . ATTACHMENTS_TABLE . ' @@ -2038,7 +2038,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode while ($row = $db->sql_fetchrow($result)); $db->sql_freeresult($result); - if (sizeof($rowset) == 1 && !$in_post_mode) + if (count($rowset) == 1 && !$in_post_mode) { return false; } @@ -2051,7 +2051,7 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode // Re-order rowset to be able to get the next/prev message rows... $rowset = array_values($rowset); - for ($i = 0, $size = sizeof($rowset); $i < $size; $i++) + for ($i = 0, $size = count($rowset); $i < $size; $i++) { $row = &$rowset[$i]; $id = (int) $row['msg_id']; @@ -2197,7 +2197,7 @@ function get_recipient_strings($pm_by_id) foreach ($_types as $ug_type) { - if (isset($address[$message_id][$ug_type]) && sizeof($address[$message_id][$ug_type])) + if (isset($address[$message_id][$ug_type]) && count($address[$message_id][$ug_type])) { foreach ($address[$message_id][$ug_type] as $ug_id => $in_to) { diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php index 0fc8a7eea5..67ce2211e7 100644 --- a/phpBB/includes/functions_transfer.php +++ b/phpBB/includes/functions_transfer.php @@ -112,7 +112,7 @@ class transfer $dir = explode('/', $dir); $dirs = ''; - for ($i = 0, $total = sizeof($dir); $i < $total; $i++) + for ($i = 0, $total = count($dir); $i < $total; $i++) { $result = true; diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php index 2f3405f915..b878b1af0a 100644 --- a/phpBB/includes/mcp/mcp_ban.php +++ b/phpBB/includes/mcp/mcp_ban.php @@ -268,7 +268,7 @@ class mcp_ban { $post_info = phpbb_get_post_data($post_id, 'm_ban'); - if (sizeof($post_info) && !empty($post_info[$post_id])) + if (count($post_info) && !empty($post_info[$post_id])) { switch ($mode) { diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 3e214797c8..19f71e092a 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -96,14 +96,14 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $pagination = $phpbb_container->get('pagination'); $selected_ids = ''; - if (sizeof($post_id_list) && $action != 'merge_topics') + if (count($post_id_list) && $action != 'merge_topics') { foreach ($post_id_list as $num => $post_id) { $selected_ids .= '&post_id_list[' . $num . ']=' . $post_id; } } - else if (sizeof($topic_id_list) && $action == 'merge_topics') + else if (count($topic_id_list) && $action == 'merge_topics') { foreach ($topic_id_list as $num => $topic_id) { @@ -221,13 +221,13 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $db->sql_freeresult($result); // If there is more than one page, but we have no topic list, then the start parameter is... erm... out of sync - if (!sizeof($topic_list) && $forum_topics && $start > 0) + if (!count($topic_list) && $forum_topics && $start > 0) { redirect($url . "&i=$id&action=$action&mode=$mode"); } // Get topic tracking info - if (sizeof($topic_list)) + if (count($topic_list)) { if ($config['load_db_lastread']) { @@ -358,7 +358,7 @@ function mcp_resync_topics($topic_ids) { global $db, $user, $phpbb_log, $request; - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -389,7 +389,7 @@ function mcp_resync_topics($topic_ids) } $db->sql_freeresult($result); - $msg = (sizeof($topic_ids) == 1) ? $user->lang['TOPIC_RESYNC_SUCCESS'] : $user->lang['TOPICS_RESYNC_SUCCESS']; + $msg = (count($topic_ids) == 1) ? $user->lang['TOPIC_RESYNC_SUCCESS'] : $user->lang['TOPICS_RESYNC_SUCCESS']; $redirect = $request->variable('redirect', $user->data['session_page']); @@ -406,7 +406,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) { global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher; - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { $template->assign_var('MESSAGE', $user->lang['NO_TOPIC_SELECTED']); return; @@ -421,7 +421,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $all_topic_data = phpbb_get_topic_data($sync_topics, 'm_merge'); - if (!sizeof($all_topic_data) || empty($all_topic_data[$to_topic_id])) + if (!count($all_topic_data) || empty($all_topic_data[$to_topic_id])) { $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); return; @@ -440,7 +440,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $post_id_list = $request->variable('post_id_list', array(0)); $start = $request->variable('start', 0); - if (!sizeof($post_id_list) && sizeof($topic_ids)) + if (!count($post_id_list) && count($topic_ids)) { $sql = 'SELECT post_id FROM ' . POSTS_TABLE . ' @@ -455,7 +455,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) $db->sql_freeresult($result); } - if (!sizeof($post_id_list)) + if (!count($post_id_list)) { $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); return; diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index c34c915a40..cbc84e8c64 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -115,7 +115,7 @@ class mcp_logs { if (confirm_box(true)) { - if ($deletemark && sizeof($marked)) + if ($deletemark && count($marked)) { $conditions = array( 'forum_id' => array('IN' => $forum_list), @@ -221,7 +221,7 @@ class mcp_logs 'IP' => $row['ip'], 'DATE' => $user->format_date($row['time']), 'ACTION' => $row['action'], - 'DATA' => (sizeof($data)) ? implode(' | ', $data) : '', + 'DATA' => (count($data)) ? implode(' | ', $data) : '', 'ID' => $row['id'], ) ); diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 3d56bba21c..2133bd9a19 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -47,7 +47,7 @@ class mcp_main case 'unlock': $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -60,7 +60,7 @@ class mcp_main $post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0)); - if (!sizeof($post_ids)) + if (!count($post_ids)) { trigger_error('NO_POST_SELECTED'); } @@ -75,7 +75,7 @@ class mcp_main $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -88,7 +88,7 @@ class mcp_main $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -101,7 +101,7 @@ class mcp_main $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -118,7 +118,7 @@ class mcp_main $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); $soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false; - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -135,7 +135,7 @@ class mcp_main $post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0)); $soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false; - if (!sizeof($post_ids)) + if (!count($post_ids)) { trigger_error('NO_POST_SELECTED'); } @@ -148,7 +148,7 @@ class mcp_main $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } @@ -193,7 +193,7 @@ class mcp_main $forum_info = phpbb_get_forum_data($forum_id, 'm_', true); - if (!sizeof($forum_info)) + if (!count($forum_info)) { $this->main('main', 'front'); return; @@ -342,7 +342,7 @@ function lock_unlock($action, $ids) ); extract($phpbb_dispatcher->trigger_event('core.mcp_lock_unlock_after', compact($vars))); - $success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS'; + $success_msg = $l_prefix . ((count($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS'; meta_refresh(2, $redirect); $message = $user->lang[$success_msg]; @@ -355,7 +355,7 @@ function lock_unlock($action, $ids) } else { - confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields); + confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((count($ids) == 1) ? '' : 'S'), $s_hidden_fields); } redirect($redirect); @@ -373,25 +373,25 @@ function change_topic_type($action, $topic_ids) case 'make_announce': $new_topic_type = POST_ANNOUNCE; $check_acl = 'f_announce'; - $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_ANNOUNCEMENT' : 'MCP_MAKE_ANNOUNCEMENTS'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_ANNOUNCEMENT' : 'MCP_MAKE_ANNOUNCEMENTS'; break; case 'make_global': $new_topic_type = POST_GLOBAL; $check_acl = 'f_announce_global'; - $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS'; break; case 'make_sticky': $new_topic_type = POST_STICKY; $check_acl = 'f_sticky'; - $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_STICKY' : 'MCP_MAKE_STICKIES'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_STICKY' : 'MCP_MAKE_STICKIES'; break; default: $new_topic_type = POST_NORMAL; $check_acl = false; - $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS'; break; } @@ -419,7 +419,7 @@ function change_topic_type($action, $topic_ids) WHERE " . $db->sql_in_set('topic_id', $topic_ids); $db->sql_query($sql); - if (($new_topic_type == POST_GLOBAL) && sizeof($topic_ids)) + if (($new_topic_type == POST_GLOBAL) && count($topic_ids)) { // Delete topic shadows for global announcements $sql = 'DELETE FROM ' . TOPICS_TABLE . ' @@ -432,9 +432,9 @@ function change_topic_type($action, $topic_ids) $db->sql_query($sql); } - $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED'; + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED'; - if (sizeof($topic_ids)) + if (count($topic_ids)) { $data = phpbb_get_topic_data($topic_ids); @@ -496,7 +496,7 @@ function mcp_move_topic($topic_ids) { $forum_data = phpbb_get_forum_data($to_forum_id, 'f_post'); - if (!sizeof($forum_data)) + if (!count($forum_data)) { $additional_msg = $user->lang['FORUM_NOT_EXIST']; } @@ -691,7 +691,7 @@ function mcp_move_topic($topic_ids) $sync_sql[$forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted - ' . (int) $topics_moved_softdeleted; } - $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS'; + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS'; foreach ($sync_sql as $forum_id_key => $array) { @@ -714,7 +714,7 @@ function mcp_move_topic($topic_ids) 'ADDITIONAL_MSG' => $additional_msg) ); - confirm_box(false, 'MOVE_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); + confirm_box(false, 'MOVE_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); } $redirect = $request->variable('redirect', "index.$phpEx"); @@ -762,7 +762,7 @@ function mcp_restore_topic($topic_ids) if (confirm_box(true)) { - $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS'; + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS'; $data = phpbb_get_topic_data($topic_ids); @@ -784,7 +784,7 @@ function mcp_restore_topic($topic_ids) } else { - confirm_box(false, (sizeof($topic_ids) == 1) ? 'RESTORE_TOPIC' : 'RESTORE_TOPICS', $s_hidden_fields); + confirm_box(false, (count($topic_ids) == 1) ? 'RESTORE_TOPIC' : 'RESTORE_TOPICS', $s_hidden_fields); } $topic_id = $request->variable('t', 0); @@ -842,7 +842,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' if (confirm_box(true)) { - $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS'; + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS'; $data = phpbb_get_topic_data($topic_ids); @@ -927,10 +927,10 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' 'S_TOPIC_MODE' => true, 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id), 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id), - 'DELETE_TOPIC_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_TOPIC_PERMANENTLY', sizeof($topic_ids)), + 'DELETE_TOPIC_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_TOPIC_PERMANENTLY', count($topic_ids)), )); - $l_confirm = (sizeof($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS'; + $l_confirm = (count($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS'; if ($only_softdeleted) { $l_confirm .= '_PERMANENTLY'; @@ -1042,11 +1042,11 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', { $phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), $soft_delete_reason, isset($topic_data['first_post']), isset($topic_data['last_post'])); } - $affected_topics = sizeof($topic_info); + $affected_topics = count($topic_info); // None of the topics is really deleted, so a redirect won't hurt much. $deleted_topics = 0; - $success_msg = (sizeof($post_info) == 1) ? $user->lang['POST_DELETED_SUCCESS'] : $user->lang['POSTS_DELETED_SUCCESS']; + $success_msg = (count($post_info) == 1) ? $user->lang['POST_DELETED_SUCCESS'] : $user->lang['POSTS_DELETED_SUCCESS']; foreach ($approve_log as $row) { @@ -1093,7 +1093,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', { $topic_id_list[] = $row['topic_id']; } - $affected_topics = sizeof($topic_id_list); + $affected_topics = count($topic_id_list); $db->sql_freeresult($result); $post_data = phpbb_get_post_data($post_ids); @@ -1132,7 +1132,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', } $return_link[] = sprintf($user->lang['RETURN_FORUM'], '', ''); - if (sizeof($post_ids) == 1) + if (count($post_ids) == 1) { if ($deleted_topics) { @@ -1181,10 +1181,10 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', 'S_SOFTDELETED' => $only_softdeleted, 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id), 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id), - 'DELETE_POST_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_POST_PERMANENTLY', sizeof($post_ids)), + 'DELETE_POST_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_POST_PERMANENTLY', count($post_ids)), )); - $l_confirm = (sizeof($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS'; + $l_confirm = (count($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS'; if ($only_softdeleted) { $l_confirm .= '_PERMANENTLY'; @@ -1247,11 +1247,11 @@ function mcp_fork_topic($topic_ids) { $forum_data = phpbb_get_forum_data($to_forum_id, 'f_post'); - if (!sizeof($topic_ids)) + if (!count($topic_ids)) { $additional_msg = $user->lang['NO_TOPIC_SELECTED']; } - else if (!sizeof($forum_data)) + else if (!count($forum_data)) { $additional_msg = $user->lang['FORUM_NOT_EXIST']; } @@ -1409,7 +1409,7 @@ function mcp_fork_topic($topic_ids) } $db->sql_freeresult($result); - if (!sizeof($post_rows)) + if (!count($post_rows)) { continue; } @@ -1512,7 +1512,7 @@ function mcp_fork_topic($topic_ids) } $db->sql_freeresult($result); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary); } @@ -1536,7 +1536,7 @@ function mcp_fork_topic($topic_ids) } $db->sql_freeresult($result); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); } @@ -1557,7 +1557,7 @@ function mcp_fork_topic($topic_ids) } $db->sql_freeresult($result); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary); } @@ -1589,7 +1589,7 @@ function mcp_fork_topic($topic_ids) sync('topic', 'topic_id', $new_topic_id_list); sync('forum', 'forum_id', $to_forum_id); - $config->increment('num_topics', sizeof($new_topic_id_list), false); + $config->increment('num_topics', count($new_topic_id_list), false); $config->increment('num_posts', $total_posts, false); foreach ($new_topic_id_list as $topic_id => $new_topic_id) @@ -1601,7 +1601,7 @@ function mcp_fork_topic($topic_ids) )); } - $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS'; + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS'; } else { @@ -1611,7 +1611,7 @@ function mcp_fork_topic($topic_ids) 'ADDITIONAL_MSG' => $additional_msg) ); - confirm_box(false, 'FORK_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); + confirm_box(false, 'FORK_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); } $redirect = $request->variable('redirect', "index.$phpEx"); diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index 67a1a959e4..c17b9985af 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -55,7 +55,7 @@ class mcp_pm_reports $report_id_list = $request->variable('report_id_list', array(0)); - if (!sizeof($report_id_list)) + if (!count($report_id_list)) { trigger_error('NO_REPORT_SELECTED'); } @@ -104,7 +104,7 @@ class mcp_pm_reports $pm_info = phpbb_get_pm_data(array($pm_id)); - if (!sizeof($pm_info)) + if (!count($pm_info)) { trigger_error('NO_REPORT_SELECTED'); } @@ -141,7 +141,7 @@ class mcp_pm_reports } $db->sql_freeresult($result); - if (sizeof($attachments)) + if (count($attachments)) { $update_count = array(); parse_attachments(0, $message, $attachments, $update_count); @@ -251,7 +251,7 @@ class mcp_pm_reports } $db->sql_freeresult($result); - if (sizeof($report_ids)) + if (count($report_ids)) { $sql = 'SELECT p.*, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru @@ -270,7 +270,7 @@ class mcp_pm_reports } $db->sql_freeresult($result); - if (sizeof($pm_list)) + if (count($pm_list)) { $address_list = get_recipient_strings($pm_by_id); diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 60ec3b8f5a..d6d0369e48 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -38,7 +38,7 @@ function mcp_post_details($id, $mode, $action) add_form_key('mcp_post_details'); - if (!sizeof($post_info)) + if (!count($post_info)) { trigger_error('POST_NOT_EXIST'); } @@ -165,7 +165,7 @@ function mcp_post_details($id, $mode, $action) } $db->sql_freeresult($result); - if (sizeof($attachments)) + if (count($attachments)) { $user->add_lang('viewtopic'); $update_count = array(); @@ -409,7 +409,7 @@ function mcp_post_details($id, $mode, $action) ); } - if (sizeof($users_ary)) + if (count($users_ary)) { // Get the usernames $sql = 'SELECT user_id, username @@ -495,7 +495,7 @@ function mcp_post_details($id, $mode, $action) $user_select = ''; - if (sizeof($usernames_ary)) + if (count($usernames_ary)) { ksort($usernames_ary); @@ -656,7 +656,7 @@ function change_poster(&$post_info, $userdata) // Renew post info $post_info = phpbb_get_post_data(array($post_id), false, true); - if (!sizeof($post_info)) + if (!count($post_info)) { trigger_error('POST_NOT_EXIST'); } diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index f379392b12..643bdec4d8 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -179,7 +179,7 @@ class mcp_queue $post_info = phpbb_get_post_data(array($post_id), 'm_approve', true); - if (!sizeof($post_info)) + if (!count($post_info)) { trigger_error('NO_POST_SELECTED'); } @@ -230,7 +230,7 @@ class mcp_queue } $db->sql_freeresult($result); - if (sizeof($attachments)) + if (count($attachments)) { $update_count = array(); parse_attachments($post_info['forum_id'], $message, $attachments, $update_count); @@ -349,7 +349,7 @@ class mcp_queue { $topic_info = phpbb_get_topic_data(array($topic_id)); - if (!sizeof($topic_info)) + if (!count($topic_info)) { trigger_error('TOPIC_NOT_EXIST'); } @@ -379,7 +379,7 @@ class mcp_queue $forum_list[] = $row['forum_id']; } - if (!sizeof($forum_list)) + if (!count($forum_list)) { trigger_error('NOT_MODERATOR'); } @@ -395,7 +395,7 @@ class mcp_queue { $forum_info = phpbb_get_forum_data(array($forum_id), $m_perm); - if (!sizeof($forum_info)) + if (!count($forum_info)) { trigger_error('NOT_MODERATOR'); } @@ -465,7 +465,7 @@ class mcp_queue } $db->sql_freeresult($result); - if (sizeof($post_ids)) + if (count($post_ids)) { $sql = 'SELECT t.topic_id, t.topic_title, t.forum_id, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u @@ -537,7 +537,7 @@ class mcp_queue $db->sql_freeresult($result); } - if (sizeof($forum_names)) + if (count($forum_names)) { // Select the names for the forum_ids $sql = 'SELECT forum_id, forum_name @@ -771,7 +771,7 @@ class mcp_queue } else { - $success_msg = (sizeof($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS'; + $success_msg = (count($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS'; } /** @@ -814,7 +814,7 @@ class mcp_queue $message .= '

' . $user->lang('RETURN_PAGE', '', ''); // If approving one post, also give links back to post... - if (sizeof($post_info) == 1 && $post_url) + if (count($post_info) == 1 && $post_url) { $message .= '

' . $user->lang('RETURN_POST', '', ''); } @@ -847,14 +847,14 @@ class mcp_queue // Create the confirm box message $action_msg = strtoupper($action); - $num_posts = sizeof($post_id_list) - $num_topics; + $num_posts = count($post_id_list) - $num_topics; if ($num_topics > 0 && $num_posts <= 0) { $action_msg .= '_TOPIC' . (($num_topics == 1) ? '' : 'S'); } else { - $action_msg .= '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'); + $action_msg .= '_POST' . ((count($post_id_list) == 1) ? '' : 'S'); } confirm_box(false, $action_msg, $s_hidden_fields, 'mcp_approve.html'); } @@ -919,9 +919,9 @@ class mcp_queue ); } - if (sizeof($topic_info) >= 1) + if (count($topic_info) >= 1) { - $success_msg = (sizeof($topic_info) == 1) ? 'TOPIC_' . strtoupper($action) . 'D_SUCCESS' : 'TOPICS_' . strtoupper($action) . 'D_SUCCESS'; + $success_msg = (count($topic_info) == 1) ? 'TOPIC_' . strtoupper($action) . 'D_SUCCESS' : 'TOPICS_' . strtoupper($action) . 'D_SUCCESS'; } foreach ($approve_log as $log_data) @@ -1024,7 +1024,7 @@ class mcp_queue $message .= '

' . $user->lang('RETURN_PAGE', '', ''); // If approving one topic, also give links back to topic... - if (sizeof($topic_info) == 1 && $topic_url) + if (count($topic_info) == 1 && $topic_url) { $message .= '

' . $user->lang('RETURN_TOPIC', '', ''); } @@ -1055,7 +1055,7 @@ class mcp_queue 'S_' . strtoupper($action) => true, )); - confirm_box(false, strtoupper($action) . '_TOPIC' . ((sizeof($topic_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); + confirm_box(false, strtoupper($action) . '_TOPIC' . ((count($topic_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); } redirect($redirect); @@ -1206,8 +1206,8 @@ class mcp_queue } // Get disapproved posts/topics counts separately - $num_disapproved_topics = sizeof($disapprove_log_topics); - $num_disapproved_posts = sizeof($disapprove_log_posts); + $num_disapproved_topics = count($disapprove_log_topics); + $num_disapproved_posts = count($disapprove_log_posts); // Build the whole log $disapprove_log = array_merge($disapprove_log_topics, $disapprove_log_posts); @@ -1216,7 +1216,7 @@ class mcp_queue unset($post_data, $disapprove_log_topics, $disapprove_log_posts); // Let's do the job - delete disapproved posts - if (sizeof($post_disapprove_list)) + if (count($post_disapprove_list)) { if (!function_exists('delete_posts')) { @@ -1444,7 +1444,7 @@ class mcp_queue $l_confirm_msg = 'DELETE_POST_PERMANENTLY'; $confirm_template = 'confirm_delete_body.html'; } - $l_confirm_msg .= ((sizeof($post_id_list) == 1) ? '' : 'S'); + $l_confirm_msg .= ((count($post_id_list) == 1) ? '' : 'S'); $template->assign_vars(array( 'S_NOTIFY_POSTER' => $show_notify, diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 1462acf110..f5147deb49 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -53,7 +53,7 @@ class mcp_reports $report_id_list = $request->variable('report_id_list', array(0)); - if (!sizeof($report_id_list)) + if (!count($report_id_list)) { trigger_error('NO_REPORT_SELECTED'); } @@ -158,7 +158,7 @@ class mcp_reports $post_info = phpbb_get_post_data(array($post_id), 'm_report', true); - if (!sizeof($post_info)) + if (!count($post_info)) { trigger_error('NO_REPORT_SELECTED'); } @@ -222,7 +222,7 @@ class mcp_reports } $db->sql_freeresult($result); - if (sizeof($attachments)) + if (count($attachments)) { $update_count = array(); parse_attachments($post_info['forum_id'], $message, $attachments, $update_count); @@ -321,7 +321,7 @@ class mcp_reports { $topic_info = phpbb_get_topic_data(array($topic_id)); - if (!sizeof($topic_info)) + if (!count($topic_info)) { trigger_error('TOPIC_NOT_EXIST'); } @@ -346,7 +346,7 @@ class mcp_reports $forum_list[] = $row['forum_id']; } - if (!sizeof($forum_list)) + if (!count($forum_list)) { trigger_error('NOT_MODERATOR'); } @@ -362,7 +362,7 @@ class mcp_reports { $forum_info = phpbb_get_forum_data(array($forum_id), 'm_report'); - if (!sizeof($forum_info)) + if (!count($forum_info)) { trigger_error('NOT_MODERATOR'); } @@ -443,7 +443,7 @@ class mcp_reports } $db->sql_freeresult($result); - if (sizeof($report_ids)) + if (count($report_ids)) { $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru @@ -617,12 +617,12 @@ function close_report($report_id_list, $mode, $action, $pm = false) } $db->sql_freeresult($result); - if (sizeof($reports)) + if (count($reports)) { $close_report_posts = array_unique($close_report_posts); $close_report_topics = array_unique($close_report_topics); - if (!$pm && sizeof($close_report_posts)) + if (!$pm && count($close_report_posts)) { // Get a list of topics that still contain reported posts $sql = 'SELECT DISTINCT topic_id @@ -658,7 +658,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) } $db->sql_query($sql); - if (sizeof($close_report_posts)) + if (count($close_report_posts)) { if ($pm) { @@ -679,7 +679,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) WHERE ' . $db->sql_in_set('post_id', $close_report_posts); $db->sql_query($sql); - if (sizeof($close_report_topics)) + if (count($close_report_topics)) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_reported = 0 @@ -721,7 +721,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) } // Notify reporters - if (sizeof($notify_reporters)) + if (count($notify_reporters)) { foreach ($notify_reporters as $report_id => $reporter) { @@ -761,11 +761,11 @@ function close_report($report_id_list, $mode, $action, $pm = false) unset($notify_reporters, $post_info, $reports); - $success_msg = (sizeof($report_id_list) == 1) ? "{$pm_prefix}REPORT_" . strtoupper($action) . 'D_SUCCESS' : "{$pm_prefix}REPORTS_" . strtoupper($action) . 'D_SUCCESS'; + $success_msg = (count($report_id_list) == 1) ? "{$pm_prefix}REPORT_" . strtoupper($action) . 'D_SUCCESS' : "{$pm_prefix}REPORTS_" . strtoupper($action) . 'D_SUCCESS'; } else { - confirm_box(false, $user->lang[strtoupper($action) . "_{$pm_prefix}REPORT" . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields); + confirm_box(false, $user->lang[strtoupper($action) . "_{$pm_prefix}REPORT" . ((count($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields); } $redirect = $request->variable('redirect', "index.$phpEx"); @@ -784,12 +784,12 @@ function close_report($report_id_list, $mode, $action, $pm = false) if (!$pm) { - if (sizeof($forum_ids) === 1) + if (count($forum_ids) === 1) { $return_forum = sprintf($user->lang['RETURN_FORUM'], '', '') . '

'; } - if (sizeof($topic_ids) === 1) + if (count($topic_ids) === 1) { $return_topic = sprintf($user->lang['RETURN_TOPIC'], '', '') . '

'; } diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 76df5b3a5e..9c63245982 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -36,7 +36,7 @@ function mcp_topic_view($id, $mode, $action) $topic_id = $request->variable('t', 0); $topic_info = phpbb_get_topic_data(array($topic_id), false, true); - if (!sizeof($topic_info)) + if (!count($topic_info)) { trigger_error('TOPIC_NOT_EXIST'); } @@ -97,7 +97,7 @@ function mcp_topic_view($id, $mode, $action) include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); - if (!sizeof($post_id_list)) + if (!count($post_id_list)) { trigger_error('NO_POST_SELECTED'); } @@ -172,7 +172,7 @@ function mcp_topic_view($id, $mode, $action) // Grab extensions $attachments = array(); - if ($topic_info['topic_attachment'] && sizeof($post_id_list)) + if ($topic_info['topic_attachment'] && count($post_id_list)) { // Get attachments... if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id'])) @@ -326,7 +326,7 @@ function mcp_topic_view($id, $mode, $action) { $to_topic_info = phpbb_get_topic_data(array($to_topic_id), 'm_merge'); - if (!sizeof($to_topic_info)) + if (!count($to_topic_info)) { $to_topic_id = 0; } @@ -408,7 +408,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $forum_id = $request->variable('forum_id', 0); $start = $request->variable('start', 0); - if (!sizeof($post_id_list)) + if (!count($post_id_list)) { $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); return; @@ -422,7 +422,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $post_id = $post_id_list[0]; $post_info = phpbb_get_post_data(array($post_id)); - if (!sizeof($post_info)) + if (!count($post_info)) { $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); return; @@ -446,7 +446,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $forum_info = phpbb_get_forum_data(array($to_forum_id), 'f_post'); - if (!sizeof($forum_info)) + if (!count($forum_info)) { $template->assign_var('MESSAGE', $user->lang['USER_CANNOT_POST']); return; @@ -530,7 +530,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $db->sql_freeresult($result); } - if (!sizeof($post_id_list)) + if (!count($post_id_list)) { trigger_error('NO_POST_SELECTED'); } @@ -628,7 +628,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) } $db->sql_freeresult($result); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); } @@ -649,7 +649,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) } $db->sql_freeresult($result); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary); } @@ -690,7 +690,7 @@ function merge_posts($topic_id, $to_topic_id) $topic_data = phpbb_get_topic_data($sync_topics, 'm_merge'); - if (!sizeof($topic_data) || empty($topic_data[$to_topic_id])) + if (!count($topic_data) || empty($topic_data[$to_topic_id])) { $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); return; @@ -707,7 +707,7 @@ function merge_posts($topic_id, $to_topic_id) $post_id_list = $request->variable('post_id_list', array(0)); $start = $request->variable('start', 0); - if (!sizeof($post_id_list)) + if (!count($post_id_list)) { $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); return; diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index d6e36fec39..cb6e391bb8 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -705,10 +705,10 @@ class bbcode_firstpass extends bbcode if ($tok == ']') { // if $tok is ']' the buffer holds a tag - if (strtolower($buffer) == '/list' && sizeof($list_end_tags)) + if (strtolower($buffer) == '/list' && count($list_end_tags)) { // valid [/list] tag, check nesting so that we don't hit false positives - if (sizeof($item_end_tags) && sizeof($item_end_tags) >= sizeof($list_end_tags)) + if (count($item_end_tags) && count($item_end_tags) >= count($list_end_tags)) { // current li tag has not been closed $out = preg_replace('/\n?\[$/', '[', $out) . array_pop($item_end_tags) . ']['; @@ -733,10 +733,10 @@ class bbcode_firstpass extends bbcode } else { - if (($buffer == '*' || substr($buffer, -2) == '[*') && sizeof($list_end_tags)) + if (($buffer == '*' || substr($buffer, -2) == '[*') && count($list_end_tags)) { // the buffer holds a bullet tag and we have a [list] tag open - if (sizeof($item_end_tags) >= sizeof($list_end_tags)) + if (count($item_end_tags) >= count($list_end_tags)) { if (substr($buffer, -2) == '[*') { @@ -780,11 +780,11 @@ class bbcode_firstpass extends bbcode while ($in); // do we have some tags open? close them now - if (sizeof($item_end_tags)) + if (count($item_end_tags)) { $out .= '[' . implode('][', $item_end_tags) . ']'; } - if (sizeof($list_end_tags)) + if (count($list_end_tags)) { $out .= '[' . implode('][', $list_end_tags) . ']'; } @@ -835,7 +835,7 @@ class bbcode_firstpass extends bbcode if ($tok == ']') { - if (strtolower($buffer) == '/quote' && sizeof($close_tags) && substr($out, -1, 1) == '[') + if (strtolower($buffer) == '/quote' && count($close_tags) && substr($out, -1, 1) == '[') { // we have found a closing tag $out .= array_pop($close_tags) . ']'; @@ -949,7 +949,7 @@ class bbcode_firstpass extends bbcode $out .= $buffer; - if (sizeof($close_tags)) + if (count($close_tags)) { $out .= '[' . implode('][', $close_tags) . ']'; } @@ -1500,7 +1500,7 @@ class parse_message extends bbcode_firstpass $db->sql_freeresult($result); } - if (sizeof($match)) + if (count($match)) { if ($max_smilies) { @@ -1534,7 +1534,7 @@ class parse_message extends bbcode_firstpass $error = array(); - $num_attachments = sizeof($this->attachment_data); + $num_attachments = count($this->attachment_data); $this->filename_data['filecomment'] = $request->variable('filecomment', '', true); $upload = $request->file($form_name); $upload_file = (!empty($upload) && $upload['name'] !== 'none' && trim($upload['name'])); @@ -1571,7 +1571,7 @@ class parse_message extends bbcode_firstpass $filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message); $error = $filedata['error']; - if ($filedata['post_attach'] && !sizeof($error)) + if ($filedata['post_attach'] && !count($error)) { $sql_ary = array( 'physical_filename' => $filedata['physical_filename'], @@ -1621,7 +1621,7 @@ class parse_message extends bbcode_firstpass } } - if ($preview || $refresh || sizeof($error)) + if ($preview || $refresh || count($error)) { if (isset($this->plupload) && $this->plupload->is_active()) { @@ -1692,7 +1692,7 @@ class parse_message extends bbcode_firstpass $filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message); $error = array_merge($error, $filedata['error']); - if (!sizeof($error)) + if (!count($error)) { $sql_ary = array( 'physical_filename' => $filedata['physical_filename'], @@ -1774,7 +1774,7 @@ class parse_message extends bbcode_firstpass $check_user_id = ($check_user_id === false) ? $user->data['user_id'] : $check_user_id; - if (!sizeof($attachment_data)) + if (!count($attachment_data)) { return; } @@ -1794,7 +1794,7 @@ class parse_message extends bbcode_firstpass } // Regenerate already posted attachments - if (sizeof($not_orphan)) + if (count($not_orphan)) { // Get the attachment data, based on the poster id... $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize @@ -1814,13 +1814,13 @@ class parse_message extends bbcode_firstpass $db->sql_freeresult($result); } - if (sizeof($not_orphan)) + if (count($not_orphan)) { trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR); } // Regenerate newly uploaded attachments - if (sizeof($orphan)) + if (count($orphan)) { $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize FROM ' . ATTACHMENTS_TABLE . ' @@ -1840,7 +1840,7 @@ class parse_message extends bbcode_firstpass $db->sql_freeresult($result); } - if (sizeof($orphan)) + if (count($orphan)) { trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR); } @@ -1861,7 +1861,7 @@ class parse_message extends bbcode_firstpass $tmp_message = $this->message; $poll['poll_options'] = preg_split('/\s*?\n\s*/', trim($poll['poll_option_text'])); - $poll['poll_options_size'] = sizeof($poll['poll_options']); + $poll['poll_options_size'] = count($poll['poll_options']); foreach ($poll['poll_options'] as &$poll_option) { @@ -1890,7 +1890,7 @@ class parse_message extends bbcode_firstpass } } - if (sizeof($poll['poll_options']) == 1) + if (count($poll['poll_options']) == 1) { $this->warn_msg[] = $user->lang['TOO_FEW_POLL_OPTIONS']; } diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php index 66c3109b3d..c1b623cd71 100644 --- a/phpBB/includes/ucp/ucp_attachments.php +++ b/phpBB/includes/ucp/ucp_attachments.php @@ -38,7 +38,7 @@ class ucp_attachments $delete = (isset($_POST['delete'])) ? true : false; $delete_ids = array_keys($request->variable('attachment', array(0))); - if ($delete && sizeof($delete_ids)) + if ($delete && count($delete_ids)) { // Validate $delete_ids... $sql = 'SELECT attach_id @@ -56,7 +56,7 @@ class ucp_attachments $db->sql_freeresult($result); } - if ($delete && sizeof($delete_ids)) + if ($delete && count($delete_ids)) { $s_hidden_fields = array( 'delete' => 1 @@ -75,12 +75,12 @@ class ucp_attachments unset($attachment_manager); meta_refresh(3, $this->u_action); - $message = ((sizeof($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + $message = ((count($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); trigger_error($message); } else { - confirm_box(false, (sizeof($delete_ids) == 1) ? 'DELETE_ATTACHMENT' : 'DELETE_ATTACHMENTS', build_hidden_fields($s_hidden_fields)); + confirm_box(false, (count($delete_ids) == 1) ? 'DELETE_ATTACHMENT' : 'DELETE_ATTACHMENTS', build_hidden_fields($s_hidden_fields)); } } diff --git a/phpBB/includes/ucp/ucp_auth_link.php b/phpBB/includes/ucp/ucp_auth_link.php index 08aacdef3a..e069f15eb2 100644 --- a/phpBB/includes/ucp/ucp_auth_link.php +++ b/phpBB/includes/ucp/ucp_auth_link.php @@ -55,14 +55,14 @@ class ucp_auth_link $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); // This path is only for primary actions - if (!sizeof($error) && $submit) + if (!count($error) && $submit) { if (!check_form_key('ucp_auth_link')) { $error[] = 'FORM_INVALID'; } - if (!sizeof($error)) + if (!count($error)) { // Any post data could be necessary for auth (un)linking $link_data = $request->get_super_global(\phpbb\request\request_interface::POST); diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 0d3d16065b..5f7a784b3a 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -71,7 +71,7 @@ class ucp_groups } $db->sql_freeresult($result); - if (!sizeof($group_row)) + if (!count($group_row)) { trigger_error('GROUP_NOT_EXIST'); } @@ -330,7 +330,7 @@ class ucp_groups $sql = 'SELECT group_id, group_name, group_colour, group_desc, group_desc_uid, group_desc_bitfield, group_desc_options, group_type, group_founder_manage FROM ' . GROUPS_TABLE . ' - WHERE ' . ((sizeof($group_id_ary)) ? $db->sql_in_set('group_id', $group_id_ary, true) . ' AND ' : '') . " + WHERE ' . ((count($group_id_ary)) ? $db->sql_in_set('group_id', $group_id_ary, true) . ' AND ' : '') . " group_type $sql_and ORDER BY group_type DESC, group_name"; $result = $db->sql_query($sql); @@ -562,7 +562,7 @@ class ucp_groups $error = array_merge($error, $colour_error); } - if (!sizeof($error)) + if (!count($error)) { // Only set the rank, colour, etc. if it's changed or if we're adding a new // group. This prevents existing group members being updated if no changes @@ -605,7 +605,7 @@ class ucp_groups } } - if (sizeof($error)) + if (count($error)) { $error = array_map(array(&$user, 'lang'), $error); $group_rank = $submit_ary['rank']; @@ -703,12 +703,12 @@ class ucp_groups 'S_EDIT' => true, 'S_INCLUDE_SWATCH' => true, 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', - 'S_ERROR' => (sizeof($error)) ? true : false, + 'S_ERROR' => (count($error)) ? true : false, 'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false, 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), 'S_GROUP_MANAGE' => true, - 'ERROR_MSG' => (sizeof($error)) ? implode('
', $error) : '', + 'ERROR_MSG' => (count($error)) ? implode('
', $error) : '', 'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '', 'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0, 'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0, @@ -911,7 +911,7 @@ class ucp_groups if (confirm_box(true)) { - if (!sizeof($mark_ary)) + if (!count($mark_ary)) { $start = 0; @@ -934,7 +934,7 @@ class ucp_groups group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row); - $start = (sizeof($mark_ary) < 200) ? 0 : $start + 200; + $start = (count($mark_ary) < 200) ? 0 : $start + 200; } else { @@ -1073,7 +1073,7 @@ class ucp_groups 'action' => $action ); - confirm_box(false, $user->lang('GROUP_CONFIRM_ADD_USERS', sizeof($name_ary), implode($user->lang['COMMA_SEPARATOR'], $name_ary)), build_hidden_fields($s_hidden_fields)); + confirm_box(false, $user->lang('GROUP_CONFIRM_ADD_USERS', count($name_ary), implode($user->lang['COMMA_SEPARATOR'], $name_ary)), build_hidden_fields($s_hidden_fields)); } trigger_error($user->lang['NO_USERS_ADDED'] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 77ac1dfb54..71a615e75c 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -230,10 +230,10 @@ class ucp_main $forums = array_keys($request->variable('f', array(0 => 0))); $topics = array_keys($request->variable('t', array(0 => 0))); - if (sizeof($forums) || sizeof($topics)) + if (count($forums) || count($topics)) { $l_unwatch = ''; - if (sizeof($forums)) + if (count($forums)) { $sql = 'DELETE FROM ' . FORUMS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forums) . ' @@ -243,7 +243,7 @@ class ucp_main $l_unwatch .= '_FORUMS'; } - if (sizeof($topics)) + if (count($topics)) { $sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topics) . ' @@ -453,7 +453,7 @@ class ucp_main $topics = (isset($_POST['t'])) ? array_keys($request->variable('t', array(0 => 0))) : array(); $url = $this->u_action; - if (!sizeof($topics)) + if (!count($topics)) { trigger_error('NO_BOOKMARKS_SELECTED'); } @@ -508,7 +508,7 @@ class ucp_main { $drafts = array_keys($request->variable('d', array(0 => 0))); - if (sizeof($drafts)) + if (count($drafts)) { $sql = 'DELETE FROM ' . DRAFTS_TABLE . ' WHERE ' . $db->sql_in_set('draft_id', $drafts) . ' @@ -594,7 +594,7 @@ class ucp_main } $db->sql_freeresult($result); - if (sizeof($topic_ids)) + if (count($topic_ids)) { $sql = 'SELECT topic_id, forum_id, topic_title FROM ' . TOPICS_TABLE . ' diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php index 51bd77bd4c..ae11294259 100644 --- a/phpBB/includes/ucp/ucp_notifications.php +++ b/phpBB/includes/ucp/ucp_notifications.php @@ -203,7 +203,7 @@ class ucp_notifications } $template->assign_vars(array( - strtoupper($block) . '_COLS' => sizeof($notification_methods) + 2, + strtoupper($block) . '_COLS' => count($notification_methods) + 2, )); } diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 86cdb090c8..bf18e76568 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -406,7 +406,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $quote_username = (isset($post['quote_username'])) ? $post['quote_username'] : ''; $icon_id = (isset($post['icon_id'])) ? $post['icon_id'] : 0; - if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !sizeof($address_list) && !$refresh && !$submit && !$preview) + if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !count($address_list) && !$refresh && !$submit && !$preview) { // Add the original author as the recipient if quoting a post or only replying and not having checked "reply to all" if ($action == 'quotepost' || !$reply_to_all) @@ -428,7 +428,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) } } } - else if ($action == 'edit' && !sizeof($address_list) && !$refresh && !$submit && !$preview) + else if ($action == 'edit' && !count($address_list) && !$refresh && !$submit && !$preview) { // Rebuild TO and BCC Header $address_list = rebuild_header(array('to' => $post['to_address'], 'bcc' => $post['bcc_address'])); @@ -561,7 +561,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) unset($list[$user->data['user_id']]); } - $max_recipients = ($max_recipients < sizeof($list)) ? sizeof($list) : $max_recipients; + $max_recipients = ($max_recipients < count($list)) ? count($list) : $max_recipients; unset($list); } @@ -584,7 +584,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) } // Check for too many recipients - if (!empty($address_list['u']) && $max_recipients && sizeof($address_list['u']) > $max_recipients) + if (!empty($address_list['u']) && $max_recipients && count($address_list['u']) > $max_recipients) { $address_list = get_recipients($address_list, $max_recipients); $error[] = $user->lang('TOO_MANY_RECIPIENTS', $max_recipients); @@ -788,7 +788,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) // Parse Attachments - before checksum is calculated $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true); - if (sizeof($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc)) + if (count($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc)) { $error[] = implode('
', $message_parser->warn_msg); $message_parser->warn_msg = array(); @@ -798,7 +798,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $message_parser->parse($enable_bbcode, ($config['allow_post_links']) ? $enable_urls : false, $enable_smilies, $img_status, $flash_status, true, $config['allow_post_links']); // On a refresh we do not care about message parsing errors - if (sizeof($message_parser->warn_msg) && !$refresh) + if (count($message_parser->warn_msg) && !$refresh) { $error[] = implode('
', $message_parser->warn_msg); } @@ -825,14 +825,14 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $error[] = $user->lang['EMPTY_MESSAGE_SUBJECT']; } - if (!sizeof($address_list)) + if (!count($address_list)) { $error[] = $user->lang['NO_RECIPIENT']; } } // Store message, sync counters - if (!sizeof($error) && $submit) + if (!count($error) && $submit) { $pm_data = array( 'msg_id' => (int) $msg_id, @@ -889,7 +889,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) } // Preview - if (!sizeof($error) && $preview) + if (!count($error) && $preview) { $preview_message = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false); @@ -909,7 +909,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) } // Attachment Preview - if (sizeof($message_parser->attachment_data)) + if (count($message_parser->attachment_data)) { $template->assign_var('S_HAS_ATTACHMENTS', true); @@ -929,7 +929,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $preview_subject = censor_text($subject); - if (!sizeof($error)) + if (!count($error)) { $template->assign_vars(array( 'PREVIEW_SUBJECT' => $preview_subject, @@ -943,7 +943,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) } // Decode text for message display - $bbcode_uid = (($action == 'quote' || $action == 'forward') && !$preview && !$refresh && (!sizeof($error) || (sizeof($error) && !$submit))) ? $bbcode_uid : $message_parser->bbcode_uid; + $bbcode_uid = (($action == 'quote' || $action == 'forward') && !$preview && !$refresh && (!count($error) || (count($error) && !$submit))) ? $bbcode_uid : $message_parser->bbcode_uid; $message_parser->decode_message($bbcode_uid); @@ -1035,7 +1035,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) // Build address list for display // array('u' => array($author_id => 'to')); - if (sizeof($address_list)) + if (count($address_list)) { // Get Usernames and Group Names $result = array(); @@ -1198,7 +1198,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) 'URL_STATUS' => ($url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MAX_FONT_SIZE' => (int) $config['max_post_font_size'], 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), - 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'ERROR' => (count($error)) ? implode('
', $error) : '', 'MAX_RECIPIENTS' => ($config['allow_mass_pm'] && ($auth->acl_get('u_masspm') || $auth->acl_get('u_masspm_group'))) ? $max_recipients : 0, 'S_COMPOSE_PM' => true, @@ -1300,7 +1300,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove } // If add to or add bcc not pressed, users could still have usernames listed they want to add... - if (!$add_to && !$add_bcc && (sizeof($group_list) || sizeof($usernames))) + if (!$add_to && !$add_bcc && (count($group_list) || count($usernames))) { $add_to = true; @@ -1321,7 +1321,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove { $type = ($add_to) ? 'to' : 'bcc'; - if (sizeof($group_list)) + if (count($group_list)) { foreach ($group_list as $group_id) { @@ -1333,13 +1333,13 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove $user_id_ary = array(); // Reveal the correct user_ids - if (sizeof($usernames)) + if (count($usernames)) { $user_id_ary = array(); user_get_id_name($user_id_ary, $usernames, array(USER_NORMAL, USER_FOUNDER, USER_INACTIVE)); // If there are users not existing, we will at least print a notice... - if (!sizeof($user_id_ary)) + if (!count($user_id_ary)) { $error[] = $user->lang['PM_NO_USERS']; } @@ -1408,7 +1408,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove $error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION']; } - if (!sizeof(array_keys($address_list['u']))) + if (!count(array_keys($address_list['u']))) { return; } @@ -1466,7 +1466,7 @@ function num_recipients($address_list) foreach ($address_list as $field => $adr_ary) { - $num_recipients += sizeof($adr_ary); + $num_recipients += count($adr_ary); } return $num_recipients; diff --git a/phpBB/includes/ucp/ucp_pm_options.php b/phpBB/includes/ucp/ucp_pm_options.php index 2458c4118d..3861962516 100644 --- a/phpBB/includes/ucp/ucp_pm_options.php +++ b/phpBB/includes/ucp/ucp_pm_options.php @@ -521,7 +521,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $action_option = $request->variable('action_option', ''); $back = (isset($_REQUEST['back'])) ? $request->variable('back', array('' => 0)) : array(); - if (sizeof($back)) + if (count($back)) { if ($action_option) { diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index b5bb406d7d..2acc528b9f 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -114,7 +114,7 @@ function view_folder($id, $mode, $folder_id, $folder) ); // Okay, lets dump out the page ... - if (sizeof($folder_info['pm_list'])) + if (count($folder_info['pm_list'])) { $address_list = array(); @@ -236,7 +236,7 @@ function view_folder($id, $mode, $folder_id, $folder) $_types = array('u', 'g'); foreach ($_types as $ug_type) { - if (isset($address_temp[$message_id][$ug_type]) && sizeof($address_temp[$message_id][$ug_type])) + if (isset($address_temp[$message_id][$ug_type]) && count($address_temp[$message_id][$ug_type])) { if (!isset($address[$message_id][$ug_type])) { @@ -269,8 +269,8 @@ function view_folder($id, $mode, $folder_id, $folder) // There is the chance that all recipients of the message got deleted. To avoid creating // exports without recipients, we add a bogus "undisclosed recipient". - if (!(isset($address[$message_id]['g']) && sizeof($address[$message_id]['g'])) && - !(isset($address[$message_id]['u']) && sizeof($address[$message_id]['u']))) + if (!(isset($address[$message_id]['g']) && count($address[$message_id]['g'])) && + !(isset($address[$message_id]['u']) && count($address[$message_id]['u']))) { $address[$message_id]['u'] = array(); $address[$message_id]['u']['to'] = array(); diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 48d14a133c..11d45adc64 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -113,7 +113,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $db->sql_freeresult($result); // No attachments exist, but message table thinks they do so go ahead and reset attach flags - if (!sizeof($attachments)) + if (!count($attachments)) { $sql = 'UPDATE ' . PRIVMSGS_TABLE . " SET message_attachment = 0 @@ -134,7 +134,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) parse_attachments(false, $message, $attachments, $update_count); // Update the attachment download counts - if (sizeof($update_count)) + if (count($update_count)) { $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET download_count = download_count + 1 @@ -240,7 +240,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) 'U_PM_ACTION' => $url . '&mode=compose&f=' . $folder_id . '&p=' . $message_row['msg_id'], - 'S_HAS_ATTACHMENTS' => (sizeof($attachments)) ? true : false, + 'S_HAS_ATTACHMENTS' => (count($attachments)) ? true : false, 'S_DISPLAY_NOTICE' => $display_notice && $message_row['message_attachment'], 'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false, 'S_SPECIAL_FOLDER' => in_array($folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)), @@ -330,7 +330,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) } // Display not already displayed Attachments for this post, we already parsed them. ;) - if (isset($attachments) && sizeof($attachments)) + if (isset($attachments) && count($attachments)) { foreach ($attachments as $attachment) { diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index c2aa910ed0..7785aeb07b 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -96,7 +96,7 @@ class ucp_prefs $error[] = 'FORM_INVALID'; } - if (!sizeof($error)) + if (!count($error)) { $sql_ary = array( 'user_allow_pm' => $data['allowpm'], @@ -188,7 +188,7 @@ class ucp_prefs $db->sql_freeresult($result); $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'ERROR' => (count($error)) ? implode('
', $error) : '', 'S_NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false, 'S_NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false, @@ -277,7 +277,7 @@ class ucp_prefs $error[] = 'FORM_INVALID'; } - if (!sizeof($error)) + if (!count($error)) { $user->optionset('viewimg', $data['images']); $user->optionset('viewflash', $data['flash']); @@ -412,7 +412,7 @@ class ucp_prefs extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_view_after', compact($vars))); $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'ERROR' => (count($error)) ? implode('
', $error) : '', 'S_IMAGES' => $data['images'], 'S_FLASH' => $data['flash'], diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index b7f8501fe4..beb440ce76 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -98,7 +98,7 @@ class ucp_profile $passwords_manager = $phpbb_container->get('passwords.manager'); // Only check the new password against the previous password if there have been no errors - if (!sizeof($error) && $auth->acl_get('u_chgpasswd') && $data['new_password'] && $passwords_manager->check($data['new_password'], $user->data['user_password'])) + if (!count($error) && $auth->acl_get('u_chgpasswd') && $data['new_password'] && $passwords_manager->check($data['new_password'], $user->data['user_password'])) { $error[] = 'SAME_PASSWORD_ERROR'; } @@ -125,7 +125,7 @@ class ucp_profile $vars = array('data', 'submit', 'error'); extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_validate', compact($vars))); - if (!sizeof($error)) + if (!count($error)) { $sql_ary = array( 'username' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $data['username'] : $user->data['username'], @@ -220,7 +220,7 @@ class ucp_profile $vars = array('data', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_sql_ary', compact($vars))); - if (sizeof($sql_ary)) + if (count($sql_ary)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' @@ -257,7 +257,7 @@ class ucp_profile } $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'ERROR' => (count($error)) ? implode('
', $error) : '', 'USERNAME' => $data['username'], 'EMAIL' => $data['email'], @@ -343,7 +343,7 @@ class ucp_profile // validate custom profile fields $cp->submit_cp_field('profile', $user->get_iso_lang_id(), $cp_data, $cp_error); - if (sizeof($cp_error)) + if (count($cp_error)) { $error = array_merge($error, $cp_error); } @@ -365,7 +365,7 @@ class ucp_profile $vars = array('data', 'submit', 'error'); extract($phpbb_dispatcher->trigger_event('core.ucp_profile_validate_profile_info', compact($vars))); - if (!sizeof($error)) + if (!count($error)) { $data['notify'] = $user->data['user_notify_type']; @@ -449,7 +449,7 @@ class ucp_profile } $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'ERROR' => (count($error)) ? implode('
', $error) : '', 'S_JABBER_ENABLED' => $config['jab_enable'], 'JABBER' => $data['jabber'], )); @@ -537,7 +537,7 @@ class ucp_profile 'sig' ); - if (sizeof($warn_msg)) + if (count($warn_msg)) { $error += $warn_msg; } @@ -549,7 +549,7 @@ class ucp_profile } else { - if (!sizeof($error)) + if (!count($error)) { $user->optionset('sig_bbcode', $enable_bbcode); $user->optionset('sig_smilies', $enable_smilies); @@ -594,7 +594,7 @@ class ucp_profile $controller_helper = $phpbb_container->get('controller.helper'); $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'ERROR' => (count($error)) ? implode('
', $error) : '', 'SIGNATURE' => $decoded_message['text'], 'SIGNATURE_PREVIEW' => $signature_preview, @@ -753,7 +753,7 @@ class ucp_profile $avatar = phpbb_get_user_avatar($user->data, 'USER_AVATAR', true); $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'ERROR' => (count($error)) ? implode('
', $error) : '', 'AVATAR' => $avatar, 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', @@ -778,7 +778,7 @@ class ucp_profile $error[] = 'FORM_INVALID'; } - if (!sizeof($error)) + if (!count($error)) { if (!empty($keys)) { @@ -825,7 +825,7 @@ class ucp_profile } $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'ERROR' => (count($error)) ? implode('
', $error) : '', 'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 594100ac65..3031cacacb 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -167,7 +167,7 @@ class ucp_register unset($now); $template->assign_vars(array( - 'S_LANG_OPTIONS' => (sizeof($lang_row) > 1) ? language_select($user_lang) : '', + 'S_LANG_OPTIONS' => (count($lang_row) > 1) ? language_select($user_lang) : '', 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), @@ -185,7 +185,7 @@ class ucp_register else { $template->assign_vars(array( - 'S_LANG_OPTIONS' => (sizeof($lang_row) > 1) ? language_select($user_lang) : '', + 'S_LANG_OPTIONS' => (count($lang_row) > 1) ? language_select($user_lang) : '', 'L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()), 'S_SHOW_COPPA' => false, @@ -297,7 +297,7 @@ class ucp_register // validate custom profile fields $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error); - if (!sizeof($error)) + if (!count($error)) { if ($data['new_password'] != $data['password_confirm']) { @@ -318,7 +318,7 @@ class ucp_register $vars = array('submit', 'data', 'cp_data', 'error'); extract($phpbb_dispatcher->trigger_event('core.ucp_register_data_after', compact($vars))); - if (!sizeof($error)) + if (!count($error)) { $server_url = generate_board_url(); @@ -532,7 +532,7 @@ class ucp_register phpbb_timezone_select($template, $user, $data['tz'], true); $template->assign_vars(array( - 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'ERROR' => (count($error)) ? implode('
', $error) : '', 'USERNAME' => $data['username'], 'PASSWORD' => $data['new_password'], 'PASSWORD_CONFIRM' => $data['password_confirm'], diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php index fa6a03f87c..b4c561fc76 100644 --- a/phpBB/includes/ucp/ucp_zebra.php +++ b/phpBB/includes/ucp/ucp_zebra.php @@ -47,7 +47,7 @@ class ucp_zebra $data[$var] = $request->variable($var, $default, true); } - if (!empty($data['add']) || sizeof($data['usernames'])) + if (!empty($data['add']) || count($data['usernames'])) { if (confirm_box(true)) { @@ -105,35 +105,35 @@ class ucp_zebra $db->sql_freeresult($result); // remove friends from the username array - $n = sizeof($data['add']); + $n = count($data['add']); $data['add'] = array_diff($data['add'], $friends); - if (sizeof($data['add']) < $n && $mode == 'foes') + if (count($data['add']) < $n && $mode == 'foes') { $error[] = $user->lang['NOT_ADDED_FOES_FRIENDS']; } // remove foes from the username array - $n = sizeof($data['add']); + $n = count($data['add']); $data['add'] = array_diff($data['add'], $foes); - if (sizeof($data['add']) < $n && $mode == 'friends') + if (count($data['add']) < $n && $mode == 'friends') { $error[] = $user->lang['NOT_ADDED_FRIENDS_FOES']; } // remove the user himself from the username array - $n = sizeof($data['add']); + $n = count($data['add']); $data['add'] = array_diff($data['add'], array(utf8_clean_string($user->data['username']))); - if (sizeof($data['add']) < $n) + if (count($data['add']) < $n) { $error[] = $user->lang['NOT_ADDED_' . $l_mode . '_SELF']; } unset($friends, $foes, $n); - if (sizeof($data['add'])) + if (count($data['add'])) { $sql = 'SELECT user_id, user_type FROM ' . USERS_TABLE . ' @@ -159,7 +159,7 @@ class ucp_zebra } $db->sql_freeresult($result); - if (sizeof($user_id_ary)) + if (count($user_id_ary)) { // Remove users from foe list if they are admins or moderators if ($mode == 'foes') @@ -175,7 +175,7 @@ class ucp_zebra $perms = array_unique($perms); - if (sizeof($perms)) + if (count($perms)) { $error[] = $user->lang['NOT_ADDED_FOES_MOD_ADMIN']; } @@ -185,7 +185,7 @@ class ucp_zebra unset($perms); } - if (sizeof($user_id_ary)) + if (count($user_id_ary)) { $sql_mode = ($mode == 'friends') ? 'friend' : 'foe'; @@ -218,7 +218,7 @@ class ucp_zebra } unset($user_id_ary); } - else if (!sizeof($error)) + else if (!count($error)) { $error[] = $user->lang['USER_NOT_FOUND_OR_INACTIVE']; } @@ -244,7 +244,7 @@ class ucp_zebra else if ($updated) { meta_refresh(3, $this->u_action); - $message = $user->lang[$l_mode . '_UPDATED'] . '
' . implode('
', $error) . ((sizeof($error)) ? '
' : '') . '
' . sprintf($user->lang['RETURN_UCP'], '', ''); + $message = $user->lang[$l_mode . '_UPDATED'] . '
' . implode('
', $error) . ((count($error)) ? '
' : '') . '
' . sprintf($user->lang['RETURN_UCP'], '', ''); trigger_error($message); } else diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index 01caf47349..89de454427 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -1390,7 +1390,7 @@ function utf8_wordwrap($string, $width = 75, $break = "\n", $cut = false) { $words = explode(' ', $line); - for ($i = 0, $size = sizeof($words); $i < $size; $i++) + for ($i = 0, $size = count($words); $i < $size; $i++) { $word = $words[$i]; diff --git a/phpBB/install/convert/controller/convertor.php b/phpBB/install/convert/controller/convertor.php index 7b2a00d7b9..3639b10dc5 100644 --- a/phpBB/install/convert/controller/convertor.php +++ b/phpBB/install/convert/controller/convertor.php @@ -537,7 +537,7 @@ class convertor foreach ($prefixes as $prefix => $count) { - if ($count >= sizeof($tables)) + if ($count >= count($tables)) { $possible_prefix = $prefix; break; @@ -730,7 +730,7 @@ class convertor include_once($this->phpbb_root_path . 'install/convertors/' . $entry); if (isset($convertor_data)) { - $sort[strtolower($convertor_data['forum_name'])] = sizeof($convertors); + $sort[strtolower($convertor_data['forum_name'])] = count($convertors); $convertors[] = array( 'tag' => $m[1], diff --git a/phpBB/install/convert/convertor.php b/phpBB/install/convert/convertor.php index f7f05ebdae..5118651b71 100644 --- a/phpBB/install/convert/convertor.php +++ b/phpBB/install/convert/convertor.php @@ -312,9 +312,9 @@ class convertor } } - if (sizeof($bad_folders)) + if (count($bad_folders)) { - $msg = (sizeof($bad_folders) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE']; + $msg = (count($bad_folders) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE']; sort($bad_folders); $this->error(sprintf($msg, implode('
', $bad_folders)), __LINE__, __FILE__, true); @@ -371,7 +371,7 @@ class convertor $val = array($val); } - for ($j = 0, $size = sizeof($val); $j < $size; ++$j) + for ($j = 0, $size = count($val); $j < $size; ++$j) { if (preg_match('/LEFT JOIN ([a-z0-9_]+) AS ([a-z0-9_]+)/i', $val[$j], $m)) { @@ -412,11 +412,11 @@ class convertor // Throw an error if some tables are missing // We used to do some guessing here, but since we have a suggestion of possible values earlier, I don't see it adding anything here to do it again - if (sizeof($missing_tables) == sizeof($tables_list)) + if (count($missing_tables) == count($tables_list)) { $this->error($user->lang['NO_TABLES_FOUND'] . ' ' . $user->lang['CHECK_TABLE_PREFIX'], __LINE__, __FILE__); } - else if (sizeof($missing_tables)) + else if (count($missing_tables)) { $this->error(sprintf($user->lang['TABLES_MISSING'], implode($user->lang['COMMA_SEPARATOR'], $missing_tables)) . '

' . $user->lang['CHECK_TABLE_PREFIX'], __LINE__, __FILE__); } @@ -514,7 +514,7 @@ class convertor )); // This loop takes one target table and processes it - while ($current_table < sizeof($convert->convertor['schema'])) + while ($current_table < count($convert->convertor['schema'])) { $schema = $convert->convertor['schema'][$current_table]; @@ -753,7 +753,7 @@ class convertor case 'mysqli': $waiting_rows[] = '(' . implode(', ', $insert_values) . ')'; - if (sizeof($waiting_rows) >= $convert->num_wait_rows) + if (count($waiting_rows) >= $convert->num_wait_rows) { $errored = false; @@ -809,7 +809,7 @@ class convertor $src_db->sql_freeresult($___result); // We might still have some rows waiting - if (sizeof($waiting_rows)) + if (count($waiting_rows)) { $errored = false; $db->sql_return_on_error(true); @@ -888,7 +888,7 @@ class convertor $current_table++; // $percentage = ($skip_rows == 0) ? 0 : floor(100 / ($total_rows / $skip_rows)); - $msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $current_table, sizeof($convert->convertor['schema'])); + $msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $current_table, count($convert->convertor['schema'])); $this->template->assign_vars(array( 'BODY' => $msg, @@ -1126,7 +1126,7 @@ class convertor } else { - while ($last_statement < sizeof($convert->convertor['execute_last'])) + while ($last_statement < count($convert->convertor['execute_last'])) { // @codingStandardsIgnoreStart eval($convert->convertor['execute_last'][$last_statement]); @@ -1140,8 +1140,8 @@ class convertor $last_statement++; $url = $this->save_convert_progress($converter, 'jump=1&last=' . $last_statement); - $percentage = ($last_statement == 0) ? 0 : floor(100 / (sizeof($convert->convertor['execute_last']) / $last_statement)); - $msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $last_statement, sizeof($convert->convertor['execute_last']), $percentage); + $percentage = ($last_statement == 0) ? 0 : floor(100 / (count($convert->convertor['execute_last']) / $last_statement)); + $msg = sprintf($user->lang['STEP_PERCENT_COMPLETED'], $last_statement, count($convert->convertor['execute_last']), $percentage); $this->template->assign_vars(array( 'L_SUBMIT' => $user->lang['CONTINUE_LAST'], diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index 6f43e1915e..8b80eec4c8 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -1071,7 +1071,7 @@ function phpbb_convert_authentication($mode) } } - if (sizeof($forum_ids)) + if (count($forum_ids)) { // Now make sure the user is able to read these forums $hold_ary = $auth->acl_group_raw_data(false, 'f_list', $forum_ids); @@ -1267,7 +1267,7 @@ function phpbb_prepare_message($message) // parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $update_this_message = true, $mode = 'post') $message_parser->parse($enable_bbcode, $enable_magic_url, $enable_smilies); - if (sizeof($message_parser->warn_msg)) + if (count($message_parser->warn_msg)) { $msg_id = isset($convert->row['post_id']) ? $convert->row['post_id'] : $convert->row['privmsgs_id']; $convert->p_master->error('' . $user->lang['POST_ID'] . ': ' . $msg_id . ' ' . $user->lang['CONV_ERROR_MESSAGE_PARSER'] . ':

' . implode('
', $message_parser->warn_msg), __LINE__, __FILE__, true); @@ -1495,7 +1495,7 @@ function phpbb_attachment_forum_perms($forum_permissions) $forum_ids[] = (int) $forum_id; } - if (sizeof($forum_ids)) + if (count($forum_ids)) { return attachment_forum_perms($forum_ids); } @@ -1860,7 +1860,7 @@ function phpbb_check_username_collisions() $db->sql_freeresult($result); // there was at least one collision, the admin will have to solve it before conversion can continue - if (sizeof($colliding_names)) + if (count($colliding_names)) { $sql = 'SELECT user_id, username_clean FROM ' . USERCONV_TABLE . ' diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 0a957260d9..c5599b7851 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -36,7 +36,7 @@ $template->assign_var('S_IN_MCP', true); $id = $request->variable('i', ''); $mode = $request->variable('mode', array('')); -$mode = sizeof($mode) ? array_shift($mode) : $request->variable('mode', ''); +$mode = count($mode) ? array_shift($mode) : $request->variable('mode', ''); // Only Moderators can go beyond this point if (!$user->data['is_registered']) @@ -59,7 +59,7 @@ if ($forum_action !== '' && $request->variable('sort', false, false, \phpbb\requ $action = $forum_action; } -if (sizeof($action_ary)) +if (count($action_ary)) { list($action, ) = each($action_ary); } diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 75438283e6..b1f3a63fae 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -729,7 +729,7 @@ switch ($mode) 'S_PROFILE_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group'), 'S_GROUP_OPTIONS' => $group_options, - 'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && sizeof($profile_fields['row'])) ? true : false, + 'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && count($profile_fields['row'])) ? true : false, 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '', 'U_USER_BAN' => ($auth->acl_get('m_ban') && $user_id != $user->data['user_id']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=ban&mode=user&u=' . $user_id, true, $user->session_id) : '', @@ -992,7 +992,7 @@ switch ($mode) // We validate form and field here, only id/class allowed $form = (!preg_match('/^[a-z0-9_-]+$/i', $form)) ? '' : $form; $field = (!preg_match('/^[a-z0-9_-]+$/i', $field)) ? '' : $field; - if ((($mode == '' || $mode == 'searchuser') || sizeof(array_intersect($request->variable_names(\phpbb\request\request_interface::GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_'))) + if ((($mode == '' || $mode == 'searchuser') || count(array_intersect($request->variable_names(\phpbb\request\request_interface::GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_'))) { $username = $request->variable('username', '', true); $email = strtolower($request->variable('email', '')); @@ -1039,7 +1039,7 @@ switch ($mode) $sql_where .= ($jabber) ? ' AND u.user_jabber ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $jabber)) . ' ' : ''; $sql_where .= (is_numeric($count) && isset($find_key_match[$count_select])) ? ' AND u.user_posts ' . $find_key_match[$count_select] . ' ' . (int) $count . ' ' : ''; - if (isset($find_key_match[$joined_select]) && sizeof($joined) == 3) + if (isset($find_key_match[$joined_select]) && count($joined) == 3) { $joined_time = gmmktime(0, 0, 0, (int) $joined[1], (int) $joined[2], (int) $joined[0]); @@ -1049,7 +1049,7 @@ switch ($mode) } } - if (isset($find_key_match[$active_select]) && sizeof($active) == 3 && $auth->acl_get('u_viewonline')) + if (isset($find_key_match[$active_select]) && count($active) == 3 && $auth->acl_get('u_viewonline')) { $active_time = gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]); @@ -1513,7 +1513,7 @@ switch ($mode) $leaders_set = false; // So, did we get any users? - if (sizeof($user_list)) + if (count($user_list)) { // Session time?! Session time... $sql = 'SELECT session_user_id, MAX(session_time) AS session_time @@ -1598,7 +1598,7 @@ switch ($mode) $vars = array('user_list', 'use_contact_fields'); extract($phpbb_dispatcher->trigger_event('core.memberlist_memberrow_before', compact($vars))); - for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i) + for ($i = 0, $end = count($user_list); $i < $end; ++$i) { $user_id = $user_list[$i]; $row = $id_cache[$user_id]; @@ -1614,21 +1614,21 @@ switch ($mode) $memberrow = array_merge(phpbb_show_profile($row, false, false, false), array( 'ROW_NUMBER' => $i + ($start + 1), - 'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false, + 'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false, 'S_GROUP_LEADER' => $is_leader, 'S_INACTIVE' => $row['user_type'] == USER_INACTIVE, 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $row['username']), )); - if (isset($cp_row['row']) && sizeof($cp_row['row'])) + if (isset($cp_row['row']) && count($cp_row['row'])) { $memberrow = array_merge($memberrow, $cp_row['row']); } $template->assign_block_vars('memberrow', $memberrow); - if (isset($cp_row['blockrow']) && sizeof($cp_row['blockrow'])) + if (isset($cp_row['blockrow']) && count($cp_row['blockrow'])) { foreach ($cp_row['blockrow'] as $field_data) { diff --git a/phpBB/phpbb/attachment/resync.php b/phpBB/phpbb/attachment/resync.php index 6c2e0a8b0d..aeacf82511 100644 --- a/phpBB/phpbb/attachment/resync.php +++ b/phpBB/phpbb/attachment/resync.php @@ -87,7 +87,7 @@ class resync */ public function resync($type, $ids) { - if (empty($type) || !is_array($ids) || !sizeof($ids) || !in_array($type, array('post', 'topic', 'message'))) + if (empty($type) || !is_array($ids) || !count($ids) || !in_array($type, array('post', 'topic', 'message'))) { return; } @@ -112,7 +112,7 @@ class resync // Now only unset those ids remaining $ids = array_diff($ids, $remaining_ids); - if (sizeof($ids)) + if (count($ids)) { $sql = 'UPDATE ' . $this->resync_table . ' SET ' . $type . '_attachment = 0 diff --git a/phpBB/phpbb/attachment/upload.php b/phpBB/phpbb/attachment/upload.php index f9863b372c..b9d32058db 100644 --- a/phpBB/phpbb/attachment/upload.php +++ b/phpBB/phpbb/attachment/upload.php @@ -162,7 +162,7 @@ class upload // Make sure the image category only holds valid images... $this->check_image($is_image); - if (sizeof($this->file->error)) + if (count($this->file->error)) { $this->file->remove(); $this->file_data['error'] = array_merge($this->file_data['error'], $this->file->error); diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php index dbd83f1eb0..f46a21a8ae 100644 --- a/phpBB/phpbb/auth/auth.php +++ b/phpBB/phpbb/auth/auth.php @@ -72,8 +72,8 @@ class auth // Verify bitstring length with options provided... $renew = false; - $global_length = sizeof($this->acl_options['global']); - $local_length = sizeof($this->acl_options['local']); + $global_length = count($this->acl_options['global']); + $local_length = count($this->acl_options['local']); // Specify comparing length (bitstring is padded to 31 bits) $global_length = ($global_length % 31) ? ($global_length - ($global_length % 31) + 31) : $global_length; @@ -236,7 +236,7 @@ class auth $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE; - if (sizeof($this->acl)) + if (count($this->acl)) { $sql .= ' WHERE ' . $db->sql_in_set('forum_id', array_keys($this->acl), true); } @@ -278,7 +278,7 @@ class auth } // If we get forum_ids not having this permission, we need to fill the remaining parts - if ($negate && sizeof($this->acl_forum_ids)) + if ($negate && count($this->acl_forum_ids)) { foreach ($this->acl_forum_ids as $f) { @@ -455,7 +455,7 @@ class auth { $hold_str = ''; - if (sizeof($hold_ary)) + if (count($hold_ary)) { ksort($hold_ary); diff --git a/phpBB/phpbb/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php index c48b771ab0..0789a6234d 100644 --- a/phpBB/phpbb/auth/provider/ldap.php +++ b/phpBB/phpbb/auth/provider/ldap.php @@ -99,7 +99,7 @@ class ldap extends \phpbb\auth\provider\base @ldap_close($ldap); - if (!is_array($result) || sizeof($result) < 2) + if (!is_array($result) || count($result) < 2) { return sprintf($this->user->lang['LDAP_NO_IDENTITY'], $this->user->data['username']); } @@ -192,7 +192,7 @@ class ldap extends \phpbb\auth\provider\base $ldap_result = @ldap_get_entries($ldap, $search); - if (is_array($ldap_result) && sizeof($ldap_result) > 1) + if (is_array($ldap_result) && count($ldap_result) > 1) { if (@ldap_bind($ldap, $ldap_result[0]['dn'], htmlspecialchars_decode($password))) { diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index fdc5f57df0..5587e69d3c 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -635,7 +635,7 @@ class oauth extends \phpbb\auth\provider\base $oauth_user_ids = array(); - if ($rows !== false && sizeof($rows)) + if ($rows !== false && count($rows)) { foreach ($rows as $row) { diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php index f5547c4bc6..8b773017c5 100644 --- a/phpBB/phpbb/avatar/driver/local.php +++ b/phpBB/phpbb/avatar/driver/local.php @@ -64,7 +64,7 @@ class local extends \phpbb\avatar\driver\driver $table_cols = isset($row['avatar_gallery_cols']) ? $row['avatar_gallery_cols'] : 4; $row_count = $col_count = $avatar_pos = 0; - $avatar_count = sizeof($avatar_list[$category]); + $avatar_count = count($avatar_list[$category]); reset($avatar_list[$category]); diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index 887a0ff258..d765a27871 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -167,7 +167,7 @@ class upload extends \phpbb\avatar\driver\driver $file->clean_filename('avatar', $prefix, $row['id']); // If there was an error during upload, then abort operation - if (sizeof($file->error)) + if (count($file->error)) { $file->remove(); $error = $file->error; @@ -221,7 +221,7 @@ class upload extends \phpbb\avatar\driver\driver unset($filedata); - if (!sizeof($error)) + if (!count($error)) { // Move file and overwrite any existing image $file->move_file($destination, true); @@ -229,7 +229,7 @@ class upload extends \phpbb\avatar\driver\driver // If there was an error during move, then clean up leftovers $error = array_merge($error, $file->error); - if (sizeof($error)) + if (count($error)) { $file->remove(); return false; @@ -291,7 +291,7 @@ class upload extends \phpbb\avatar\driver\driver ); extract($this->dispatcher->trigger_event('core.avatar_driver_upload_delete_before', compact($vars))); - if (!sizeof($error) && $this->filesystem->exists($filename)) + if (!count($error) && $this->filesystem->exists($filename)) { try { diff --git a/phpBB/phpbb/cache/driver/base.php b/phpBB/phpbb/cache/driver/base.php index f4b3dc278d..3eca521148 100644 --- a/phpBB/phpbb/cache/driver/base.php +++ b/phpBB/phpbb/cache/driver/base.php @@ -123,7 +123,7 @@ abstract class base implements \phpbb\cache\driver\driver_interface */ function sql_fetchrow($query_id) { - if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + if ($this->sql_row_pointer[$query_id] < count($this->sql_rowset[$query_id])) { return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++]; } @@ -136,7 +136,7 @@ abstract class base implements \phpbb\cache\driver\driver_interface */ function sql_fetchfield($query_id, $field) { - if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id])) + if ($this->sql_row_pointer[$query_id] < count($this->sql_rowset[$query_id])) { return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++][$field] : false; } @@ -149,7 +149,7 @@ abstract class base implements \phpbb\cache\driver\driver_interface */ function sql_rowseek($rownum, $query_id) { - if ($rownum >= sizeof($this->sql_rowset[$query_id])) + if ($rownum >= count($this->sql_rowset[$query_id])) { return false; } diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 497f00c06b..8e68bc0ac9 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -135,7 +135,7 @@ class file extends \phpbb\cache\driver\base if (file_exists($this->cache_dir . 'data_global.' . $phpEx)) { - if (!sizeof($this->vars)) + if (!count($this->vars)) { $this->load(); } @@ -290,7 +290,7 @@ class file extends \phpbb\cache\driver\base } else { - if (!sizeof($this->vars)) + if (!count($this->vars)) { $this->load(); } diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php index cc03804705..052f40c243 100644 --- a/phpBB/phpbb/cache/driver/memory.php +++ b/phpBB/phpbb/cache/driver/memory.php @@ -188,7 +188,7 @@ abstract class memory extends \phpbb\cache\driver\base } else { - if (!sizeof($this->vars)) + if (!count($this->vars)) { $this->load(); } diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php index 8a4366fed1..502ae27625 100644 --- a/phpBB/phpbb/cache/service.php +++ b/phpBB/phpbb/cache/service.php @@ -227,7 +227,7 @@ class service // Store allowed extensions forum wise if ($row['allow_group']) { - $extensions['_allowed_post'][$extension] = (!sizeof($allowed_forums)) ? 0 : $allowed_forums; + $extensions['_allowed_post'][$extension] = (!count($allowed_forums)) ? 0 : $allowed_forums; } if ($row['allow_in_pm']) diff --git a/phpBB/phpbb/captcha/char_cube3d.php b/phpBB/phpbb/captcha/char_cube3d.php index a712b16dce..0255259ac4 100644 --- a/phpBB/phpbb/captcha/char_cube3d.php +++ b/phpBB/phpbb/captcha/char_cube3d.php @@ -220,7 +220,7 @@ class char_cube3d */ function scale($vector, $length) { - if (sizeof($vector) == 2) + if (count($vector) == 2) { return array($vector[0] * $length, $vector[1] * $length); } diff --git a/phpBB/phpbb/captcha/colour_manager.php b/phpBB/phpbb/captcha/colour_manager.php index 6ca3c3fd2c..82332da810 100644 --- a/phpBB/phpbb/captcha/colour_manager.php +++ b/phpBB/phpbb/captcha/colour_manager.php @@ -256,7 +256,7 @@ class colour_manager if (is_array($resource)) { $results = array(); - for ($i = 0, $size = sizeof($resource); $i < $size; ++$i) + for ($i = 0, $size = count($resource); $i < $size; ++$i) { $results = array_merge($results, $this->mono_range($resource[$i], $count, $include_original)); } diff --git a/phpBB/phpbb/captcha/gd.php b/phpBB/phpbb/captcha/gd.php index e9538439c6..91b2f89d81 100644 --- a/phpBB/phpbb/captcha/gd.php +++ b/phpBB/phpbb/captcha/gd.php @@ -100,7 +100,7 @@ class gd $noise_bitmaps = $this->captcha_noise_bg_bitmaps(); for ($i = 0; $i < $code_len; ++$i) { - $noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, sizeof($noise_bitmaps['data']))); + $noise[$i] = new char_cube3d($noise_bitmaps, mt_rand(1, count($noise_bitmaps['data']))); $noise[$i]->range(); //$box = $noise[$i]->dimensions($sizes[$i]); @@ -1658,32 +1658,32 @@ class gd 'height' => 15, 'data' => array( - 'A' => $chars['A'][mt_rand(0, min(sizeof($chars['A']), $config['captcha_gd_fonts']) -1)], - 'B' => $chars['B'][mt_rand(0, min(sizeof($chars['B']), $config['captcha_gd_fonts']) -1)], - 'C' => $chars['C'][mt_rand(0, min(sizeof($chars['C']), $config['captcha_gd_fonts']) -1)], - 'D' => $chars['D'][mt_rand(0, min(sizeof($chars['D']), $config['captcha_gd_fonts']) -1)], - 'E' => $chars['E'][mt_rand(0, min(sizeof($chars['E']), $config['captcha_gd_fonts']) -1)], - 'F' => $chars['F'][mt_rand(0, min(sizeof($chars['F']), $config['captcha_gd_fonts']) -1)], - 'G' => $chars['G'][mt_rand(0, min(sizeof($chars['G']), $config['captcha_gd_fonts']) -1)], - 'H' => $chars['H'][mt_rand(0, min(sizeof($chars['H']), $config['captcha_gd_fonts']) -1)], - 'I' => $chars['I'][mt_rand(0, min(sizeof($chars['I']), $config['captcha_gd_fonts']) -1)], - 'J' => $chars['J'][mt_rand(0, min(sizeof($chars['J']), $config['captcha_gd_fonts']) -1)], - 'K' => $chars['K'][mt_rand(0, min(sizeof($chars['K']), $config['captcha_gd_fonts']) -1)], - 'L' => $chars['L'][mt_rand(0, min(sizeof($chars['L']), $config['captcha_gd_fonts']) -1)], - 'M' => $chars['M'][mt_rand(0, min(sizeof($chars['M']), $config['captcha_gd_fonts']) -1)], - 'N' => $chars['N'][mt_rand(0, min(sizeof($chars['N']), $config['captcha_gd_fonts']) -1)], - 'O' => $chars['O'][mt_rand(0, min(sizeof($chars['O']), $config['captcha_gd_fonts']) -1)], - 'P' => $chars['P'][mt_rand(0, min(sizeof($chars['P']), $config['captcha_gd_fonts']) -1)], - 'Q' => $chars['Q'][mt_rand(0, min(sizeof($chars['Q']), $config['captcha_gd_fonts']) -1)], - 'R' => $chars['R'][mt_rand(0, min(sizeof($chars['R']), $config['captcha_gd_fonts']) -1)], - 'S' => $chars['S'][mt_rand(0, min(sizeof($chars['S']), $config['captcha_gd_fonts']) -1)], - 'T' => $chars['T'][mt_rand(0, min(sizeof($chars['T']), $config['captcha_gd_fonts']) -1)], - 'U' => $chars['U'][mt_rand(0, min(sizeof($chars['U']), $config['captcha_gd_fonts']) -1)], - 'V' => $chars['V'][mt_rand(0, min(sizeof($chars['V']), $config['captcha_gd_fonts']) -1)], - 'W' => $chars['W'][mt_rand(0, min(sizeof($chars['W']), $config['captcha_gd_fonts']) -1)], - 'X' => $chars['X'][mt_rand(0, min(sizeof($chars['X']), $config['captcha_gd_fonts']) -1)], - 'Y' => $chars['Y'][mt_rand(0, min(sizeof($chars['Y']), $config['captcha_gd_fonts']) -1)], - 'Z' => $chars['Z'][mt_rand(0, min(sizeof($chars['Z']), $config['captcha_gd_fonts']) -1)], + 'A' => $chars['A'][mt_rand(0, min(count($chars['A']), $config['captcha_gd_fonts']) -1)], + 'B' => $chars['B'][mt_rand(0, min(count($chars['B']), $config['captcha_gd_fonts']) -1)], + 'C' => $chars['C'][mt_rand(0, min(count($chars['C']), $config['captcha_gd_fonts']) -1)], + 'D' => $chars['D'][mt_rand(0, min(count($chars['D']), $config['captcha_gd_fonts']) -1)], + 'E' => $chars['E'][mt_rand(0, min(count($chars['E']), $config['captcha_gd_fonts']) -1)], + 'F' => $chars['F'][mt_rand(0, min(count($chars['F']), $config['captcha_gd_fonts']) -1)], + 'G' => $chars['G'][mt_rand(0, min(count($chars['G']), $config['captcha_gd_fonts']) -1)], + 'H' => $chars['H'][mt_rand(0, min(count($chars['H']), $config['captcha_gd_fonts']) -1)], + 'I' => $chars['I'][mt_rand(0, min(count($chars['I']), $config['captcha_gd_fonts']) -1)], + 'J' => $chars['J'][mt_rand(0, min(count($chars['J']), $config['captcha_gd_fonts']) -1)], + 'K' => $chars['K'][mt_rand(0, min(count($chars['K']), $config['captcha_gd_fonts']) -1)], + 'L' => $chars['L'][mt_rand(0, min(count($chars['L']), $config['captcha_gd_fonts']) -1)], + 'M' => $chars['M'][mt_rand(0, min(count($chars['M']), $config['captcha_gd_fonts']) -1)], + 'N' => $chars['N'][mt_rand(0, min(count($chars['N']), $config['captcha_gd_fonts']) -1)], + 'O' => $chars['O'][mt_rand(0, min(count($chars['O']), $config['captcha_gd_fonts']) -1)], + 'P' => $chars['P'][mt_rand(0, min(count($chars['P']), $config['captcha_gd_fonts']) -1)], + 'Q' => $chars['Q'][mt_rand(0, min(count($chars['Q']), $config['captcha_gd_fonts']) -1)], + 'R' => $chars['R'][mt_rand(0, min(count($chars['R']), $config['captcha_gd_fonts']) -1)], + 'S' => $chars['S'][mt_rand(0, min(count($chars['S']), $config['captcha_gd_fonts']) -1)], + 'T' => $chars['T'][mt_rand(0, min(count($chars['T']), $config['captcha_gd_fonts']) -1)], + 'U' => $chars['U'][mt_rand(0, min(count($chars['U']), $config['captcha_gd_fonts']) -1)], + 'V' => $chars['V'][mt_rand(0, min(count($chars['V']), $config['captcha_gd_fonts']) -1)], + 'W' => $chars['W'][mt_rand(0, min(count($chars['W']), $config['captcha_gd_fonts']) -1)], + 'X' => $chars['X'][mt_rand(0, min(count($chars['X']), $config['captcha_gd_fonts']) -1)], + 'Y' => $chars['Y'][mt_rand(0, min(count($chars['Y']), $config['captcha_gd_fonts']) -1)], + 'Z' => $chars['Z'][mt_rand(0, min(count($chars['Z']), $config['captcha_gd_fonts']) -1)], '1' => array( array(0,0,0,1,1,0,0,0,0), diff --git a/phpBB/phpbb/captcha/plugins/captcha_abstract.php b/phpBB/phpbb/captcha/plugins/captcha_abstract.php index 82b08704ff..b508767d17 100644 --- a/phpBB/phpbb/captcha/plugins/captcha_abstract.php +++ b/phpBB/phpbb/captcha/plugins/captcha_abstract.php @@ -169,7 +169,7 @@ abstract class captcha_abstract } while ($row = $db->sql_fetchrow($result)); - if (sizeof($sql_in)) + if (count($sql_in)) { $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' WHERE ' . $db->sql_in_set('session_id', $sql_in); diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index 9d481acc5d..7797212ac9 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -84,7 +84,7 @@ class qa $db->sql_freeresult($result); // fallback to the board default lang - if (!sizeof($this->question_ids)) + if (!count($this->question_ids)) { $this->question_lang = $config['default_lang']; @@ -101,7 +101,7 @@ class qa } // final fallback to any language - if (!sizeof($this->question_ids)) + if (!count($this->question_ids)) { $this->question_lang = ''; @@ -311,7 +311,7 @@ class qa } while ($row = $db->sql_fetchrow($result)); - if (sizeof($sql_in)) + if (count($sql_in)) { $sql = 'DELETE FROM ' . $this->table_qa_confirm . ' WHERE ' . $db->sql_in_set('confirm_id', $sql_in); @@ -395,7 +395,7 @@ class qa $error = ''; - if (!sizeof($this->question_ids)) + if (!count($this->question_ids)) { /** @var \phpbb\log\log_interface $phpbb_log */ $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); @@ -439,7 +439,7 @@ class qa { global $db, $user; - if (!sizeof($this->question_ids)) + if (!count($this->question_ids)) { return; } @@ -465,7 +465,7 @@ class qa { global $db, $user; - if (!sizeof($this->question_ids)) + if (!count($this->question_ids)) { return; } @@ -536,7 +536,7 @@ class qa { global $db, $user; - if (!strlen($this->confirm_id) || !sizeof($this->question_ids)) + if (!strlen($this->confirm_id) || !count($this->question_ids)) { return false; } @@ -979,7 +979,7 @@ class qa if (!isset($langs[$question_data['lang_iso']]) || !strlen($question_data['question_text']) || - !sizeof($question_data['answers']) || + !count($question_data['answers']) || !is_array($question_data['answers'])) { return false; diff --git a/phpBB/phpbb/console/command/thumbnail/delete.php b/phpBB/phpbb/console/command/thumbnail/delete.php index cfa9891fbc..9f2ee822be 100644 --- a/phpBB/phpbb/console/command/thumbnail/delete.php +++ b/phpBB/phpbb/console/command/thumbnail/delete.php @@ -107,7 +107,7 @@ class delete extends \phpbb\console\command\command { $thumbnail_deleted[] = $row['attach_id']; - if (sizeof($thumbnail_deleted) === 250) + if (count($thumbnail_deleted) === 250) { $this->commit_changes($thumbnail_deleted); $thumbnail_deleted = array(); diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index bf7dc2c703..b56934fb08 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -229,12 +229,12 @@ class content_visibility return $get_forums_visibility_sql_overwrite; } - if (sizeof($approve_forums)) + if (count($approve_forums)) { // Remove moderator forums from the rest $forum_ids = array_diff($forum_ids, $approve_forums); - if (!sizeof($forum_ids)) + if (!count($forum_ids)) { // The user can see all posts/topics in all specified forums return $where_sql . $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums) . ')'; @@ -304,7 +304,7 @@ class content_visibility return $visibility_sql_overwrite; } - if (sizeof($exclude_forum_ids)) + if (count($exclude_forum_ids)) { $where_sqls[] = '(' . $this->db->sql_in_set($table_alias . 'forum_id', $exclude_forum_ids, true) . ' AND ' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ')'; @@ -314,7 +314,7 @@ class content_visibility $where_sqls[] = $table_alias . $mode . '_visibility = ' . ITEM_APPROVED; } - if (sizeof($approve_forums)) + if (count($approve_forums)) { $where_sqls[] = $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums); return '(' . implode(' OR ', $where_sqls) . ')'; @@ -565,7 +565,7 @@ class content_visibility $sql_ary[$recipient_field] = " + $count_increase"; } - if (sizeof($sql_ary)) + if (count($sql_ary)) { $forum_sql = array(); diff --git a/phpBB/phpbb/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php index 50dce35baa..2859945915 100644 --- a/phpBB/phpbb/db/driver/mssqlnative.php +++ b/phpBB/phpbb/db/driver/mssqlnative.php @@ -267,7 +267,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base unset($row['line2'], $row['line3']); } } - return (sizeof($row)) ? $row : false; + return (count($row)) ? $row : false; } /** diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php index 54238a15ef..5fd14709f8 100644 --- a/phpBB/phpbb/db/driver/oracle.php +++ b/phpBB/phpbb/db/driver/oracle.php @@ -136,7 +136,7 @@ class oracle extends \phpbb\db\driver\driver */ function _rewrite_col_compare($args) { - if (sizeof($args) == 4) + if (count($args) == 4) { if ($args[2] == '=') { @@ -290,7 +290,7 @@ class oracle extends \phpbb\db\driver\driver and/or need the db restore script, uncomment this. - if (sizeof($cols) !== sizeof($vals)) + if (count($cols) !== count($vals)) { // Try to replace some common data we know is from our restore script or from other sources $regs[3] = str_replace("'||chr(47)||'", '/', $regs[3]); @@ -332,7 +332,7 @@ class oracle extends \phpbb\db\driver\driver if ($string) { // New value if cols != value - $vals[(sizeof($cols) !== sizeof($vals)) ? $i : $i - 1] .= $string; + $vals[(count($cols) !== count($vals)) ? $i : $i - 1] .= $string; } $vals = array(0 => $vals); diff --git a/phpBB/phpbb/db/extractor/mssql_extractor.php b/phpBB/phpbb/db/extractor/mssql_extractor.php index 2817d3ebcc..4eeab4780e 100644 --- a/phpBB/phpbb/db/extractor/mssql_extractor.php +++ b/phpBB/phpbb/db/extractor/mssql_extractor.php @@ -132,14 +132,14 @@ class mssql_extractor extends base_extractor $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - if (!sizeof($rows)) + if (!count($rows)) { $sql_data .= "ALTER TABLE [$table_name] WITH NOCHECK ADD\n"; $sql_data .= "\tCONSTRAINT [{$row['CONSTRAINT_NAME']}] PRIMARY KEY CLUSTERED \n\t(\n"; } $rows[] = "\t\t[{$row['COLUMN_NAME']}]"; } - if (sizeof($rows)) + if (count($rows)) { $sql_data .= implode(",\n", $rows); $sql_data .= "\n\t) ON [PRIMARY] \nGO\n"; diff --git a/phpBB/phpbb/db/extractor/oracle_extractor.php b/phpBB/phpbb/db/extractor/oracle_extractor.php index 79a991889b..bc43a37b10 100644 --- a/phpBB/phpbb/db/extractor/oracle_extractor.php +++ b/phpBB/phpbb/db/extractor/oracle_extractor.php @@ -82,7 +82,7 @@ class oracle_extractor extends base_extractor } $this->db->sql_freeresult($result); - if (sizeof($primary_key)) + if (count($primary_key)) { $rows[] = " CONSTRAINT {$constraint_name} PRIMARY KEY (" . implode(', ', $primary_key) . ')'; } @@ -103,7 +103,7 @@ class oracle_extractor extends base_extractor } $this->db->sql_freeresult($result); - if (sizeof($unique)) + if (count($unique)) { $rows[] = " CONSTRAINT {$constraint_name} UNIQUE (" . implode(', ', $unique) . ')'; } diff --git a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php index 2c7b7edf2e..267319bb36 100644 --- a/phpBB/phpbb/db/migration/data/v310/style_update_p1.php +++ b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php @@ -133,7 +133,7 @@ class style_update_p1 extends \phpbb\db\migration\migration } // Remove old entries from styles table - if (!sizeof($valid_styles)) + if (!count($valid_styles)) { // No valid styles: remove everything and add prosilver $this->sql_query('DELETE FROM ' . STYLES_TABLE); diff --git a/phpBB/phpbb/db/migration/data/v310/teampage.php b/phpBB/phpbb/db/migration/data/v310/teampage.php index f8edbc3492..3a37b17e97 100644 --- a/phpBB/phpbb/db/migration/data/v310/teampage.php +++ b/phpBB/phpbb/db/migration/data/v310/teampage.php @@ -93,13 +93,13 @@ class teampage extends \phpbb\db\migration\migration $teampage_entries[] = array( 'group_id' => (int) $row['group_id'], 'teampage_name' => '', - 'teampage_position' => sizeof($teampage_entries) + 1, + 'teampage_position' => count($teampage_entries) + 1, 'teampage_parent' => 0, ); } $this->db->sql_freeresult($result); - if (sizeof($teampage_entries)) + if (count($teampage_entries)) { $this->db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_entries); } diff --git a/phpBB/phpbb/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php index 33aa8ff026..a351c4858e 100644 --- a/phpBB/phpbb/db/migration/tool/config.php +++ b/phpBB/phpbb/db/migration/tool/config.php @@ -134,7 +134,7 @@ class config implements \phpbb\db\migration\tool\tool_interface case 'remove': $call = 'add'; - if (sizeof($arguments) == 1) + if (count($arguments) == 1) { $arguments[] = ''; } diff --git a/phpBB/phpbb/db/migration/tool/config_text.php b/phpBB/phpbb/db/migration/tool/config_text.php index 54b45f6f6d..5fe9a25b70 100644 --- a/phpBB/phpbb/db/migration/tool/config_text.php +++ b/phpBB/phpbb/db/migration/tool/config_text.php @@ -110,7 +110,7 @@ class config_text implements \phpbb\db\migration\tool\tool_interface case 'remove': $call = 'add'; - if (sizeof($arguments) == 1) + if (count($arguments) == 1) { $arguments[] = ''; } diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index b47c426110..86348d7366 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -469,7 +469,7 @@ class module implements \phpbb\db\migration\tool\tool_interface $parent_id = $parent_id ?: 0; // If automatic adding is in action, convert array back to string to simplify things - if (is_array($data) && sizeof($data) == 1) + if (is_array($data) && count($data) == 1) { $data = $data['module_langname']; } @@ -482,7 +482,7 @@ class module implements \phpbb\db\migration\tool\tool_interface // Search for the parent module_langname $ids = array_keys($this->module_categories, $parent_id); - switch (sizeof($ids)) + switch (count($ids)) { // No parent with the given module_langname exist case 0: diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php index 9688420025..4b53aa32a7 100644 --- a/phpBB/phpbb/db/migration/tool/permission.php +++ b/phpBB/phpbb/db/migration/tool/permission.php @@ -442,7 +442,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface } ); - if (sizeof($auth_option)) + if (count($auth_option)) { return $this->permission_set($role_name, $auth_option, 'role', $has_permission); } diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index d7d7f18d2b..42f7dd7b8b 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -629,7 +629,7 @@ class migrator */ protected function process_data_step($steps, $state, $revert = false) { - if (sizeof($steps) === 0) + if (count($steps) === 0) { return true; } @@ -656,7 +656,7 @@ class migrator // Result will be null or true if everything completed correctly // Stop after each update step, to let the updater control the script runtime $result = $this->run_step($steps[$step], $last_result, $revert); - if (($result !== null && $result !== true) || $step + 1 < sizeof($steps)) + if (($result !== null && $result !== true) || $step + 1 < count($steps)) { return array( 'result' => $result, diff --git a/phpBB/phpbb/db/sql_insert_buffer.php b/phpBB/phpbb/db/sql_insert_buffer.php index 18e4814a77..30e807b154 100644 --- a/phpBB/phpbb/db/sql_insert_buffer.php +++ b/phpBB/phpbb/db/sql_insert_buffer.php @@ -92,7 +92,7 @@ class sql_insert_buffer // Flush buffer if it is full or when DB does not support multi inserts. // In the later case, the buffer will always only contain one row. - if (!$this->db->get_multi_insert() || sizeof($this->buffer) >= $this->max_buffered_rows) + if (!$this->db->get_multi_insert() || count($this->buffer) >= $this->max_buffered_rows) { return $this->flush(); } @@ -104,7 +104,7 @@ class sql_insert_buffer * Inserts a row set, i.e. an array of rows, by calling insert(). * * Please note that it is in most cases better to use insert() instead of - * first building a huge rowset. Or at least sizeof($rows) should be kept + * first building a huge rowset. Or at least count($rows) should be kept * small. * * @param array $rows diff --git a/phpBB/phpbb/db/tools/mssql.php b/phpBB/phpbb/db/tools/mssql.php index d31aa2ba0b..f924f8d5d2 100644 --- a/phpBB/phpbb/db/tools/mssql.php +++ b/phpBB/phpbb/db/tools/mssql.php @@ -440,7 +440,7 @@ class mssql extends tools { $result = $this->sql_index_drop($table_name, $index_name); $statements = array_merge($statements, $result); - if (sizeof($index_data) > 1) + if (count($index_data) > 1) { // Remove this column from the index and recreate it $recreate_indexes[$index_name] = array_diff($index_data, array($column_name)); diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php index e042d0a5d1..bec91d04f4 100644 --- a/phpBB/phpbb/event/md_exporter.php +++ b/phpBB/phpbb/event/md_exporter.php @@ -87,7 +87,7 @@ class md_exporter $this->validate_events_from_file($file_name, $this->crawl_file_for_events($file_name)); } - return sizeof($this->events); + return count($this->events); } /** @@ -113,7 +113,7 @@ class md_exporter } } - return sizeof($this->events); + return count($this->events); } /** @@ -219,7 +219,7 @@ class md_exporter ); } - return sizeof($this->events); + return count($this->events); } /** diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php index ae3553c558..fe665d1c3c 100644 --- a/phpBB/phpbb/event/php_exporter.php +++ b/phpBB/phpbb/event/php_exporter.php @@ -117,7 +117,7 @@ class php_exporter } ksort($this->events); - return sizeof($this->events); + return count($this->events); } /** @@ -199,7 +199,7 @@ class php_exporter if (strpos($content, "dispatcher->trigger_event('") || strpos($content, "dispatcher->dispatch('")) { $this->set_content(explode("\n", $content)); - for ($i = 0, $num_lines = sizeof($this->file_lines); $i < $num_lines; $i++) + for ($i = 0, $num_lines = count($this->file_lines); $i < $num_lines; $i++) { $event_line = false; $found_trigger_event = strpos($this->file_lines[$i], "dispatcher->trigger_event('"); @@ -397,7 +397,7 @@ class php_exporter if (isset($match[1])) { $vars_array = explode("', '", $match[1]); - if ($throw_multiline && sizeof($vars_array) > 6) + if ($throw_multiline && count($vars_array) > 6) { throw new \LogicException('Should use multiple lines for $vars definition ' . "for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 2); @@ -460,7 +460,7 @@ class php_exporter if (strpos($var_line, '* @var ') === 0) { $doc_line = explode(' ', $var_line, 5); - if (sizeof($doc_line) !== 5) + if (count($doc_line) !== 5) { throw new \LogicException("Found invalid line '{$this->file_lines[$this->current_event_line - $current_doc_line]}' " . "for event '{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'", 1); @@ -707,9 +707,9 @@ class php_exporter { $vars_array = array_unique($vars_array); $vars_docblock = array_unique($vars_docblock); - $sizeof_vars_array = sizeof($vars_array); + $sizeof_vars_array = count($vars_array); - if ($sizeof_vars_array !== sizeof($vars_docblock) || $sizeof_vars_array !== sizeof(array_intersect($vars_array, $vars_docblock))) + if ($sizeof_vars_array !== count($vars_docblock) || $sizeof_vars_array !== count(array_intersect($vars_array, $vars_docblock))) { throw new \LogicException("\$vars array does not match the list of '@var' tags for event " . "'{$this->current_event}' in file '{$this->current_file}:{$this->current_event_line}'"); diff --git a/phpBB/phpbb/files/filespec.php b/phpBB/phpbb/files/filespec.php index f1a32ef4a8..6847bca4cb 100644 --- a/phpBB/phpbb/files/filespec.php +++ b/phpBB/phpbb/files/filespec.php @@ -121,7 +121,7 @@ class filespec */ public function set_upload_ary($upload_ary) { - if (!isset($upload_ary) || !sizeof($upload_ary)) + if (!isset($upload_ary) || !count($upload_ary)) { return $this; } @@ -403,7 +403,7 @@ class filespec */ public function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false) { - if (sizeof($this->error)) + if (count($this->error)) { return false; } @@ -478,7 +478,7 @@ class filespec // Remove temporary filename @unlink($this->filename); - if (sizeof($this->error)) + if (count($this->error)) { return false; } diff --git a/phpBB/phpbb/files/types/form.php b/phpBB/phpbb/files/types/form.php index 832f090c47..2c3beb6e02 100644 --- a/phpBB/phpbb/files/types/form.php +++ b/phpBB/phpbb/files/types/form.php @@ -119,7 +119,7 @@ class form extends base // PHP Upload file size check $file = $this->check_upload_size($file); - if (sizeof($file->error)) + if (count($file->error)) { return $file; } diff --git a/phpBB/phpbb/files/types/local.php b/phpBB/phpbb/files/types/local.php index 7e9210b196..4dfe4f7506 100644 --- a/phpBB/phpbb/files/types/local.php +++ b/phpBB/phpbb/files/types/local.php @@ -86,7 +86,7 @@ class local extends base // PHP Upload file size check $file = $this->check_upload_size($file); - if (sizeof($file->error)) + if (count($file->error)) { return $file; } diff --git a/phpBB/phpbb/filesystem/filesystem.php b/phpBB/phpbb/filesystem/filesystem.php index 2112882d1d..3f39448f05 100644 --- a/phpBB/phpbb/filesystem/filesystem.php +++ b/phpBB/phpbb/filesystem/filesystem.php @@ -171,7 +171,7 @@ class filesystem implements filesystem_interface continue; } - if ($part === '..' && !empty($filtered) && $filtered[sizeof($filtered) - 1] !== '.' && $filtered[sizeof($filtered) - 1] !== '..') + if ($part === '..' && !empty($filtered) && $filtered[count($filtered) - 1] !== '.' && $filtered[count($filtered) - 1] !== '..') { array_pop($filtered); } @@ -671,7 +671,7 @@ class filesystem implements filesystem_interface else if (function_exists('debug_backtrace')) { $call_stack = debug_backtrace(0); - $this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', dirname($call_stack[sizeof($call_stack) - 1]['file'])); + $this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', dirname($call_stack[count($call_stack) - 1]['file'])); } else { @@ -683,7 +683,7 @@ class filesystem implements filesystem_interface //$dir_parts = explode(DIRECTORY_SEPARATOR, __DIR__); //$namespace_parts = explode('\\', trim(__NAMESPACE__, '\\')); - //$namespace_part_count = sizeof($namespace_parts); + //$namespace_part_count = count($namespace_parts); // Check if we still loading from root //if (array_slice($dir_parts, -$namespace_part_count) === $namespace_parts) @@ -807,7 +807,7 @@ class filesystem implements filesystem_interface array_pop($resolved); $resolved_path = false; } - else if ($path_part === '..' && !empty($resolved) && !in_array($resolved[sizeof($resolved) - 1], array('.', '..'))) + else if ($path_part === '..' && !empty($resolved) && !in_array($resolved[count($resolved) - 1], array('.', '..'))) { array_pop($resolved); $resolved_path = false; diff --git a/phpBB/phpbb/install/helper/database.php b/phpBB/phpbb/install/helper/database.php index 59b86a8ca7..ad0f3dd3cd 100644 --- a/phpBB/phpbb/install/helper/database.php +++ b/phpBB/phpbb/install/helper/database.php @@ -372,7 +372,7 @@ class database $tables = array_map('strtolower', $tables); $table_intersect = array_intersect($tables, $table_ary); - if (sizeof($table_intersect)) + if (count($table_intersect)) { $errors[] = array( 'title' => 'INST_ERR_PREFIX', diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php index a40d457466..351083e3ce 100644 --- a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php @@ -202,7 +202,7 @@ class ajax_iohandler extends iohandler_base if (in_array($input_options['type'], array('select', 'radio'), true)) { - for ($i = 0, $total = sizeof($input_options['options']); $i < $total; $i++) + for ($i = 0, $total = count($input_options['options']); $i < $total; $i++) { if (isset($input_options['options'][$i]['label'])) { @@ -369,7 +369,7 @@ class ajax_iohandler extends iohandler_base */ public function set_active_stage_menu($menu_path) { - $this->nav_data['active'] = $menu_path[sizeof($menu_path) - 1]; + $this->nav_data['active'] = $menu_path[count($menu_path) - 1]; $this->send_response(); } @@ -378,7 +378,7 @@ class ajax_iohandler extends iohandler_base */ public function set_finished_stage_menu($menu_path) { - $this->nav_data['finished'][] = $menu_path[sizeof($menu_path) - 1]; + $this->nav_data['finished'][] = $menu_path[count($menu_path) - 1]; $this->send_response(); } diff --git a/phpBB/phpbb/install/module/install_data/task/add_bots.php b/phpBB/phpbb/install/module/install_data/task/add_bots.php index 1f1cecceb2..07f8e025cf 100644 --- a/phpBB/phpbb/install/module/install_data/task/add_bots.php +++ b/phpBB/phpbb/install/module/install_data/task/add_bots.php @@ -239,7 +239,7 @@ class add_bots extends \phpbb\install\task_base $this->install_config->set('add_bot_index', $i); - if ($i < sizeof($this->bot_list)) + if ($i < count($this->bot_list)) { throw new resource_limit_reached_exception(); } diff --git a/phpBB/phpbb/install/module/install_data/task/add_modules.php b/phpBB/phpbb/install/module/install_data/task/add_modules.php index d21a5be823..b64f4c31db 100644 --- a/phpBB/phpbb/install/module/install_data/task/add_modules.php +++ b/phpBB/phpbb/install/module/install_data/task/add_modules.php @@ -169,7 +169,7 @@ class add_modules extends \phpbb\install\task_base $this->db->sql_return_on_error(true); $module_classes = array('acp', 'mcp', 'ucp'); - $total = sizeof($module_classes); + $total = count($module_classes); $i = $this->config->get('module_class_index', 0); $module_classes = array_slice($module_classes, $i); diff --git a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php index 8002e3ed97..54114e3f9c 100644 --- a/phpBB/phpbb/install/module/install_database/task/add_config_settings.php +++ b/phpBB/phpbb/install/module/install_database/task/add_config_settings.php @@ -327,7 +327,7 @@ class add_config_settings extends \phpbb\install\task_base } $i = $this->install_config->get('add_config_settings_index', 0); - $total = sizeof($sql_ary); + $total = count($sql_ary); $sql_ary = array_slice($sql_ary, $i); foreach ($sql_ary as $sql) diff --git a/phpBB/phpbb/install/module/install_database/task/add_default_data.php b/phpBB/phpbb/install/module/install_database/task/add_default_data.php index e32101a3f7..c05e5321fb 100644 --- a/phpBB/phpbb/install/module/install_database/task/add_default_data.php +++ b/phpBB/phpbb/install/module/install_database/task/add_default_data.php @@ -99,7 +99,7 @@ class add_default_data extends \phpbb\install\task_base $sql_query = $this->database_helper->split_sql_file($sql_query, $dbms_info[$dbms]['DELIM']); $i = $this->config->get('add_default_data_index', 0); - $total = sizeof($sql_query); + $total = count($sql_query); $sql_query = array_slice($sql_query, $i); foreach ($sql_query as $sql) diff --git a/phpBB/phpbb/install/module/install_database/task/add_tables.php b/phpBB/phpbb/install/module/install_database/task/add_tables.php index f344f91582..dc814f36ef 100644 --- a/phpBB/phpbb/install/module/install_database/task/add_tables.php +++ b/phpBB/phpbb/install/module/install_database/task/add_tables.php @@ -101,7 +101,7 @@ class add_tables extends \phpbb\install\task_base $db_table_schema = @file_get_contents($this->schema_file_path); $db_table_schema = json_decode($db_table_schema, true); - $total = sizeof($db_table_schema); + $total = count($db_table_schema); $i = $this->config->get('add_table_index', 0); $db_table_schema = array_slice($db_table_schema, $i); diff --git a/phpBB/phpbb/install/module/install_finish/task/install_extensions.php b/phpBB/phpbb/install/module/install_finish/task/install_extensions.php index 553a30ea28..5cf91c3a52 100644 --- a/phpBB/phpbb/install/module/install_finish/task/install_extensions.php +++ b/phpBB/phpbb/install/module/install_finish/task/install_extensions.php @@ -149,7 +149,7 @@ class install_extensions extends \phpbb\install\task_base $this->install_config->set('install_extensions_index', $i); - if ($i < sizeof($all_available_extensions)) + if ($i < count($all_available_extensions)) { throw new resource_limit_reached_exception(); } diff --git a/phpBB/phpbb/install/module/update_database/task/update_extensions.php b/phpBB/phpbb/install/module/update_database/task/update_extensions.php index b66847b243..0195b9c661 100644 --- a/phpBB/phpbb/install/module/update_database/task/update_extensions.php +++ b/phpBB/phpbb/install/module/update_database/task/update_extensions.php @@ -206,7 +206,7 @@ class update_extensions extends task_base $this->install_config->set('update_extensions_index', $i); - if ($i < sizeof($all_available_extensions)) + if ($i < count($all_available_extensions)) { throw new resource_limit_reached_exception(); } diff --git a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php index 1792a3b723..ee66775101 100644 --- a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php +++ b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php @@ -145,7 +145,7 @@ class diff_files extends task_base { $file_contents[] = file_get_contents($file_to_diff); - if ($file_contents[sizeof($file_contents) - 1] === false) + if ($file_contents[count($file_contents) - 1] === false) { $this->iohandler->add_error_message(array('FILE_DIFFER_ERROR_FILE_CANNOT_BE_READ', $files_to_diff)); unset($file_contents); diff --git a/phpBB/phpbb/language/language.php b/phpBB/phpbb/language/language.php index 42429c2c07..51e6d0b185 100644 --- a/phpBB/phpbb/language/language.php +++ b/phpBB/phpbb/language/language.php @@ -312,7 +312,7 @@ class language // Replace key with language entry and simply pass along... return vsprintf($lang, $args); } - else if (sizeof($lang) == 0) + else if (count($lang) == 0) { // If the language entry is an empty array, we just return the language key return $key; @@ -322,7 +322,7 @@ class language $key_found = false; // We now get the first number passed and will select the key based upon this number - for ($i = 0, $num_args = sizeof($args); $i < $num_args; $i++) + for ($i = 0, $num_args = count($args); $i < $num_args; $i++) { if (is_int($args[$i]) || is_float($args[$i])) { diff --git a/phpBB/phpbb/language/language_file_loader.php b/phpBB/phpbb/language/language_file_loader.php index 359202fd63..b6816afd16 100644 --- a/phpBB/phpbb/language/language_file_loader.php +++ b/phpBB/phpbb/language/language_file_loader.php @@ -127,7 +127,7 @@ class language_file_loader // the first directory from the path (that should be the language directory) $path_diff_parts = explode('/', $path_diff); - if (sizeof($path_diff_parts) > 1) + if (count($path_diff_parts) > 1) { array_shift($path_diff_parts); $component = implode('/', $path_diff_parts) . '/'; diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index cf3db365a4..208df04468 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -391,7 +391,7 @@ class log implements \phpbb\log\log_interface { $sql_where .= ' AND '; - if (is_array($field_value) && sizeof($field_value) == 2 && !is_array($field_value[1])) + if (is_array($field_value) && count($field_value) == 2 && !is_array($field_value[1])) { $sql_where .= $field . ' ' . $field_value[0] . ' ' . $field_value[1]; } @@ -689,9 +689,9 @@ class log implements \phpbb\log\log_interface } } - if (($num_args - sizeof($log_data_ary)) > 0) + if (($num_args - count($log_data_ary)) > 0) { - $log_data_ary = array_merge($log_data_ary, array_fill(0, $num_args - sizeof($log_data_ary), '')); + $log_data_ary = array_merge($log_data_ary, array_fill(0, $num_args - count($log_data_ary), '')); } $lang_arguments = array_merge(array($log[$i]['action']), $log_data_ary); @@ -740,7 +740,7 @@ class log implements \phpbb\log\log_interface $vars = array('log', 'topic_id_list', 'reportee_id_list'); extract($this->dispatcher->trigger_event('core.get_logs_get_additional_data', compact($vars))); - if (sizeof($topic_id_list)) + if (count($topic_id_list)) { $topic_auth = $this->get_topic_auth($topic_id_list); @@ -752,7 +752,7 @@ class log implements \phpbb\log\log_interface } } - if (sizeof($reportee_id_list)) + if (count($reportee_id_list)) { $reportee_data_list = $this->get_reportee_data($reportee_id_list); @@ -838,7 +838,7 @@ class log implements \phpbb\log\log_interface $keywords_pattern = array(); // Build pattern and keywords... - for ($i = 0, $num_keywords = sizeof($keywords); $i < $num_keywords; $i++) + for ($i = 0, $num_keywords = count($keywords); $i < $num_keywords; $i++) { $keywords_pattern[] = preg_quote($keywords[$i], '#'); $keywords[$i] = $this->db->sql_like_expression($this->db->get_any_char() . $keywords[$i] . $this->db->get_any_char()); diff --git a/phpBB/phpbb/message/form.php b/phpBB/phpbb/message/form.php index 21d4de0b4d..63bada91ff 100644 --- a/phpBB/phpbb/message/form.php +++ b/phpBB/phpbb/message/form.php @@ -139,7 +139,7 @@ abstract class form $this->errors[] = 'FORM_INVALID'; } - if (!sizeof($this->errors)) + if (!count($this->errors)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_emailtime = ' . time() . ' @@ -169,7 +169,7 @@ abstract class form add_form_key('memberlist_email'); $template->assign_vars(array( - 'ERROR_MESSAGE' => (sizeof($this->errors)) ? implode('
', $this->errors) : '', + 'ERROR_MESSAGE' => (count($this->errors)) ? implode('
', $this->errors) : '', )); } } diff --git a/phpBB/phpbb/message/message.php b/phpBB/phpbb/message/message.php index 5fd24b542e..fa701d1c77 100644 --- a/phpBB/phpbb/message/message.php +++ b/phpBB/phpbb/message/message.php @@ -209,7 +209,7 @@ class message */ public function cc_sender() { - if (!sizeof($this->recipients)) + if (!count($this->recipients)) { trigger_error('No email recipients specified'); } @@ -238,7 +238,7 @@ class message */ public function send(\messenger $messenger, $contact) { - if (!sizeof($this->recipients)) + if (!count($this->recipients)) { return; } @@ -271,7 +271,7 @@ class message 'MESSAGE' => htmlspecialchars_decode($this->body)) ); - if (sizeof($this->template_vars)) + if (count($this->template_vars)) { $messenger->assign_vars($this->template_vars); } diff --git a/phpBB/phpbb/module/module_manager.php b/phpBB/phpbb/module/module_manager.php index 67bac5b33e..00df33f62f 100644 --- a/phpBB/phpbb/module/module_manager.php +++ b/phpBB/phpbb/module/module_manager.php @@ -311,7 +311,7 @@ class module_manager // we're turning a category into a module $branch = $this->get_module_branch($module_data['module_id'], $module_data['module_class'], 'children', false); - if (sizeof($branch)) + if (count($branch)) { throw new module_not_found_exception('NO_CATEGORY_TO_MODULE'); } @@ -353,10 +353,10 @@ class module_manager } $from_data = $moved_modules[0]; - $diff = sizeof($moved_modules) * 2; + $diff = count($moved_modules) * 2; $moved_ids = array(); - for ($i = 0, $size = sizeof($moved_modules); $i < $size; ++$i) + for ($i = 0, $size = count($moved_modules); $i < $size; ++$i) { $moved_ids[] = $moved_modules[$i]['module_id']; } @@ -443,7 +443,7 @@ class module_manager $branch = $this->get_module_branch($module_id, $module_class, 'children', false); - if (sizeof($branch)) + if (count($branch)) { throw new module_exception('CANNOT_REMOVE_MODULE'); } @@ -506,7 +506,7 @@ class module_manager } $this->db->sql_freeresult($result); - if (!sizeof($target)) + if (!count($target)) { // The module is already on top or bottom throw new module_not_found_exception(); diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index 6923d96392..09c8f4a31f 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -339,7 +339,7 @@ class manager } } - if (!sizeof($notify_users)) + if (!count($notify_users)) { return; } diff --git a/phpBB/phpbb/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php index 8fb9172911..c51586afb9 100644 --- a/phpBB/phpbb/notification/type/pm.php +++ b/phpBB/phpbb/notification/type/pm.php @@ -99,7 +99,7 @@ class pm extends \phpbb\notification\type\base 'ignore_users' => array(), ), $options); - if (!sizeof($pm['recipients'])) + if (!count($pm['recipients'])) { return array(); } diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index 03221e7c7a..254f4c07b3 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -202,9 +202,9 @@ class post extends \phpbb\notification\type\base 'username' => $this->get_data('post_username'), )), $responders); - $responders_cnt = sizeof($responders); + $responders_cnt = count($responders); $responders = $this->trim_user_ary($responders); - $trimmed_responders_cnt = $responders_cnt - sizeof($responders); + $trimmed_responders_cnt = $responders_cnt - count($responders); foreach ($responders as $responder) { @@ -337,7 +337,7 @@ class post extends \phpbb\notification\type\base */ public function trim_user_ary($users) { - if (sizeof($users) > 4) + if (count($users) > 4) { array_splice($users, 3); } @@ -357,7 +357,7 @@ class post extends \phpbb\notification\type\base */ public function pre_create_insert_array($post, $notify_users) { - if (!sizeof($notify_users) || !$this->inherit_read_status) + if (!count($notify_users) || !$this->inherit_read_status) { return array(); } @@ -426,7 +426,7 @@ class post extends \phpbb\notification\type\base // Do not add more than 25 responders, // we trim the username list to "a, b, c and x others" anyway // so there is no use to add all of them anyway. - if (sizeof($responders) > 25) + if (count($responders) > 25) { return array(); } diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 671c34fe96..5c42afa8c8 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -261,7 +261,7 @@ class topic extends \phpbb\notification\type\base */ public function pre_create_insert_array($post, $notify_users) { - if (!sizeof($notify_users) || !$this->inherit_read_status) + if (!count($notify_users) || !$this->inherit_read_status) { return array(); } diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php index ea4b24af56..35b18ddf07 100644 --- a/phpBB/phpbb/profilefields/manager.php +++ b/phpBB/phpbb/profilefields/manager.php @@ -230,7 +230,7 @@ class manager */ public function update_profile_field_data($user_id, $cp_data) { - if (!sizeof($cp_data)) + if (!count($cp_data)) { return; } @@ -258,7 +258,7 @@ class manager */ public function generate_profile_fields_template_headlines($restrict_option = '') { - if (!sizeof($this->profile_cache)) + if (!count($this->profile_cache)) { $this->build_cache(); } @@ -318,12 +318,12 @@ class manager $user_ids = array($user_ids); } - if (!sizeof($this->profile_cache)) + if (!count($this->profile_cache)) { $this->build_cache(); } - if (!sizeof($user_ids)) + if (!count($user_ids)) { return array(); } @@ -486,7 +486,7 @@ class manager $sql = 'SELECT f.field_type, f.field_ident, f.field_default_value, l.lang_default_value FROM ' . $this->fields_language_table . ' l, ' . $this->fields_table . ' f WHERE l.lang_id = ' . $this->user->get_iso_lang_id() . ' - ' . ((sizeof($sql_not_in)) ? ' AND ' . $this->db->sql_in_set('f.field_ident', $sql_not_in, true) : '') . ' + ' . ((count($sql_not_in)) ? ' AND ' . $this->db->sql_in_set('f.field_ident', $sql_not_in, true) : '') . ' AND l.field_id = f.field_id'; $result = $this->db->sql_query($sql); diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php index f6f3f17a6c..9c09e27bc4 100644 --- a/phpBB/phpbb/profilefields/type/type_bool.php +++ b/phpBB/phpbb/profilefields/type/type_bool.php @@ -398,7 +398,7 @@ class type_bool extends type_base public function display_options(&$template_vars, &$field_data) { // Initialize these array elements if we are creating a new field - if (!sizeof($field_data['lang_options'])) + if (!count($field_data['lang_options'])) { // No options have been defined for a boolean field. $field_data['lang_options'][0] = ''; diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php index 17ae89e1b2..d54404bbb4 100644 --- a/phpBB/phpbb/profilefields/type/type_dropdown.php +++ b/phpBB/phpbb/profilefields/type/type_dropdown.php @@ -282,7 +282,7 @@ class type_dropdown extends type_base */ public function validate_options_on_submit($error, $field_data) { - if (!sizeof($field_data['lang_options'])) + if (!count($field_data['lang_options'])) { $error[] = $this->user->lang['NO_FIELD_ENTRIES']; } @@ -298,7 +298,7 @@ class type_dropdown extends type_base if ($step == 2 && $key == 'field_maxlen') { // Get the number of options if this key is 'field_maxlen' - return sizeof(explode("\n", $this->request->variable('lang_options', '', true))); + return count(explode("\n", $this->request->variable('lang_options', '', true))); } return parent::get_excluded_options($key, $action, $current_value, $field_data, $step); @@ -310,7 +310,7 @@ class type_dropdown extends type_base public function display_options(&$template_vars, &$field_data) { // Initialize these array elements if we are creating a new field - if (!sizeof($field_data['lang_options'])) + if (!count($field_data['lang_options'])) { // No options have been defined for the dropdown menu $field_data['lang_options'] = array(); diff --git a/phpBB/phpbb/report/controller/report.php b/phpBB/phpbb/report/controller/report.php index e1c14afde0..0aa6833dfa 100644 --- a/phpBB/phpbb/report/controller/report.php +++ b/phpBB/phpbb/report/controller/report.php @@ -141,7 +141,7 @@ class report // Handle request try { - if (!empty($submit) && sizeof($error) === 0) + if (!empty($submit) && count($error) === 0) { $this->report_handler->add_report( (int) $id, @@ -273,7 +273,7 @@ class report } $this->template->assign_vars(array( - 'ERROR' => (sizeof($error) > 0) ? implode('
', $error) : '', + 'ERROR' => (count($error) > 0) ? implode('
', $error) : '', 'S_REPORT_POST' => ($mode === 'pm') ? false : true, 'REPORT_TEXT' => $report_text, 'S_HIDDEN_FIELDS' => (!empty($s_hidden_fields)) ? $s_hidden_fields : null, @@ -302,7 +302,7 @@ class report $error[] = $visual_confirmation_response; } - if (sizeof($error) === 0) + if (count($error) === 0) { $captcha->reset(); } diff --git a/phpBB/phpbb/search/base.php b/phpBB/phpbb/search/base.php index 56de973b65..e7d0774b6c 100644 --- a/phpBB/phpbb/search/base.php +++ b/phpBB/phpbb/search/base.php @@ -133,7 +133,7 @@ class base { global $cache, $config, $db, $user; - $length = min(sizeof($id_ary), $config['search_block_size']); + $length = min(count($id_ary), $config['search_block_size']); // nothing to cache so exit if (!$length) @@ -148,7 +148,7 @@ class base if (!($store = $cache->get('_search_results_' . $search_key))) { // add the current keywords to the recent searches in the cache which are listed on the search page - if (!empty($keywords) || sizeof($author_ary)) + if (!empty($keywords) || count($author_ary)) { $sql = 'SELECT search_time FROM ' . SEARCH_RESULTS_TABLE . ' @@ -201,7 +201,7 @@ class base $store += $store_ids; // if the cache is too big - if (sizeof($store) - 2 > 20 * $config['search_block_size']) + if (count($store) - 2 > 20 * $config['search_block_size']) { // remove everything in front of two blocks in front of the current start index for ($i = 0, $n = $id_range[0] - 2 * $config['search_block_size']; $i < $n; $i++) @@ -243,7 +243,7 @@ class base global $db, $cache, $config; // clear all searches that searched for the specified words - if (sizeof($words)) + if (count($words)) { $sql_where = ''; foreach ($words as $word) @@ -264,7 +264,7 @@ class base } // clear all searches that searched for the specified authors - if (is_array($authors) && sizeof($authors)) + if (is_array($authors) && count($authors)) { $sql_where = ''; foreach ($authors as $author) diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index da1aad1c3a..1f00d38a07 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -232,9 +232,9 @@ class fulltext_mysql extends \phpbb\search\base $this->split_words = $matches[1]; // We limit the number of allowed keywords to minimize load on the database - if ($this->config['max_num_search_keywords'] && sizeof($this->split_words) > $this->config['max_num_search_keywords']) + if ($this->config['max_num_search_keywords'] && count($this->split_words) > $this->config['max_num_search_keywords']) { - trigger_error($this->user->lang('MAX_NUM_SEARCH_KEYWORDS_REFINE', (int) $this->config['max_num_search_keywords'], sizeof($this->split_words))); + trigger_error($this->user->lang('MAX_NUM_SEARCH_KEYWORDS_REFINE', (int) $this->config['max_num_search_keywords'], count($this->split_words))); } // to allow phrase search, we need to concatenate quoted words @@ -361,7 +361,7 @@ class fulltext_mysql extends \phpbb\search\base // remove too short or too long words $text = array_values($text); - for ($i = 0, $n = sizeof($text); $i < $n; $i++) + for ($i = 0, $n = count($text); $i < $n; $i++) { $text[$i] = trim($text[$i]); if (utf8_strlen($text[$i]) < $this->config['fulltext_mysql_min_word_len'] || utf8_strlen($text[$i]) > $this->config['fulltext_mysql_max_word_len']) @@ -563,12 +563,12 @@ class fulltext_mysql extends \phpbb\search\base $sql_select = ($type == 'posts') ? $sql_select . 'p.post_id' : 'DISTINCT ' . $sql_select . 't.topic_id'; $sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : ''; $field = ($type == 'posts') ? 'post_id' : 'topic_id'; - if (sizeof($author_ary) && $author_name) + if (count($author_ary) && $author_name) { // first one matches post of registered users, second one guests and deleted users $sql_author = ' AND (' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; } - else if (sizeof($author_ary)) + else if (count($author_ary)) { $sql_author = ' AND ' . $this->db->sql_in_set('p.poster_id', $author_ary); } @@ -580,7 +580,7 @@ class fulltext_mysql extends \phpbb\search\base $sql_where_options = $sql_sort_join; $sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : ''; $sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : ''; - $sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_where_options .= (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; $sql_where_options .= ' AND ' . $post_visibility; $sql_where_options .= $sql_author; $sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; @@ -659,7 +659,7 @@ class fulltext_mysql extends \phpbb\search\base public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) { // No author? No posts - if (!sizeof($author_ary)) + if (!count($author_ary)) { return 0; } @@ -736,7 +736,7 @@ class fulltext_mysql extends \phpbb\search\base { $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); } - $sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; $sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; $sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : ''; @@ -889,7 +889,7 @@ class fulltext_mysql extends \phpbb\search\base $id_ary = array_unique($id_ary); } - if (sizeof($id_ary)) + if (count($id_ary)) { $this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir); $id_ary = array_slice($id_ary, 0, $per_page); @@ -996,7 +996,7 @@ class fulltext_mysql extends \phpbb\search\base $alter_list[] = $alter_entry; } - if (sizeof($alter_list)) + if (count($alter_list)) { foreach ($alter_list as $alter) { @@ -1039,7 +1039,7 @@ class fulltext_mysql extends \phpbb\search\base $alter[] = 'DROP INDEX post_content'; } - if (sizeof($alter)) + if (count($alter)) { $this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter)); } diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php index 73dcfce9a5..bd222488a0 100644 --- a/phpBB/phpbb/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php @@ -285,7 +285,7 @@ class fulltext_native extends \phpbb\search\base ); $keywords = preg_replace($match, $replace, $keywords); - $num_keywords = sizeof(explode(' ', $keywords)); + $num_keywords = count(explode(' ', $keywords)); // We limit the number of allowed keywords to minimize load on the database if ($this->config['max_num_search_keywords'] && $num_keywords > $this->config['max_num_search_keywords']) @@ -301,7 +301,7 @@ class fulltext_native extends \phpbb\search\base $words = array(); preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#u', $keywords, $words); - if (sizeof($words[1])) + if (count($words[1])) { $keywords = '(' . implode('|', $words[1]) . ')'; } @@ -316,7 +316,7 @@ class fulltext_native extends \phpbb\search\base $common_ids = $words = array(); - if (sizeof($exact_words)) + if (count($exact_words)) { $sql = 'SELECT word_id, word_text, word_common FROM ' . SEARCH_WORDLIST_TABLE . ' @@ -426,10 +426,10 @@ class fulltext_native extends \phpbb\search\base } } } - if (sizeof($id_words)) + if (count($id_words)) { sort($id_words); - if (sizeof($id_words) > 1) + if (count($id_words) > 1) { $this->{$mode . '_ids'}[] = $id_words; } @@ -440,7 +440,7 @@ class fulltext_native extends \phpbb\search\base } } // throw an error if we shall not ignore unexistant words - else if (!$ignore_no_id && sizeof($non_common_words)) + else if (!$ignore_no_id && count($non_common_words)) { trigger_error(sprintf($this->user->lang['WORDS_IN_NO_POST'], implode($this->user->lang['COMMA_SEPARATOR'], $non_common_words))); } @@ -480,7 +480,7 @@ class fulltext_native extends \phpbb\search\base } // Return true if all words are not common words - if (sizeof($exact_words) - sizeof($this->common_words) > 0) + if (count($exact_words) - count($this->common_words) > 0) { return true; } @@ -716,7 +716,7 @@ class fulltext_native extends \phpbb\search\base } } - if (sizeof($this->must_not_contain_ids)) + if (count($this->must_not_contain_ids)) { $sql_array['LEFT_JOIN'][] = array( 'FROM' => array(SEARCH_WORDMATCH_TABLE => 'm' . $m_num), @@ -826,7 +826,7 @@ class fulltext_native extends \phpbb\search\base $sql_where[] = 'p.topic_id = ' . $topic_id; } - if (sizeof($author_ary)) + if (count($author_ary)) { if ($author_name) { @@ -840,7 +840,7 @@ class fulltext_native extends \phpbb\search\base $sql_where[] = $sql_author; } - if (sizeof($ex_fid_ary)) + if (count($ex_fid_ary)) { $sql_where[] = $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true); } @@ -1010,7 +1010,7 @@ class fulltext_native extends \phpbb\search\base public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) { // No author? No posts - if (!sizeof($author_ary)) + if (!count($author_ary)) { return 0; } @@ -1082,7 +1082,7 @@ class fulltext_native extends \phpbb\search\base { $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); } - $sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; $sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; $sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : ''; @@ -1289,7 +1289,7 @@ class fulltext_native extends \phpbb\search\base $this->db->sql_freeresult($result); } - if (sizeof($id_ary)) + if (count($id_ary)) { $this->save_ids($search_key, '', $author_ary, $total_results, $id_ary, $start, $sort_dir); $id_ary = array_slice($id_ary, 0, $per_page); @@ -1443,7 +1443,7 @@ class fulltext_native extends \phpbb\search\base // individual arrays of added and removed words for text and title. What // we need to do now is add the new words (if they don't already exist) // and then add (or remove) matches between the words and this post - if (sizeof($unique_add_words)) + if (count($unique_add_words)) { $sql = 'SELECT word_id, word_text FROM ' . SEARCH_WORDLIST_TABLE . ' @@ -1459,7 +1459,7 @@ class fulltext_native extends \phpbb\search\base $new_words = array_diff($unique_add_words, array_keys($word_ids)); $this->db->sql_transaction('begin'); - if (sizeof($new_words)) + if (count($new_words)) { $sql_ary = array(); @@ -1483,7 +1483,7 @@ class fulltext_native extends \phpbb\search\base { $title_match = ($word_in == 'title') ? 1 : 0; - if (sizeof($word_ary)) + if (count($word_ary)) { $sql_in = array(); foreach ($word_ary as $word) @@ -1512,7 +1512,7 @@ class fulltext_native extends \phpbb\search\base { $title_match = ($word_in == 'title') ? 1 : 0; - if (sizeof($word_ary)) + if (count($word_ary)) { $sql = 'INSERT INTO ' . SEARCH_WORDMATCH_TABLE . ' (post_id, word_id, title_match) SELECT ' . (int) $post_id . ', word_id, ' . (int) $title_match . ' @@ -1543,7 +1543,7 @@ class fulltext_native extends \phpbb\search\base */ public function index_remove($post_ids, $author_ids, $forum_ids) { - if (sizeof($post_ids)) + if (count($post_ids)) { $sql = 'SELECT w.word_id, w.word_text, m.title_match FROM ' . SEARCH_WORDMATCH_TABLE . ' m, ' . SEARCH_WORDLIST_TABLE . ' w @@ -1566,7 +1566,7 @@ class fulltext_native extends \phpbb\search\base } $this->db->sql_freeresult($result); - if (sizeof($title_word_ids)) + if (count($title_word_ids)) { $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' SET word_count = word_count - 1 @@ -1575,7 +1575,7 @@ class fulltext_native extends \phpbb\search\base $this->db->sql_query($sql); } - if (sizeof($message_word_ids)) + if (count($message_word_ids)) { $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' SET word_count = word_count - 1 @@ -1630,7 +1630,7 @@ class fulltext_native extends \phpbb\search\base } $this->db->sql_freeresult($result); - if (sizeof($sql_in)) + if (count($sql_in)) { // Flag the words $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' @@ -1650,7 +1650,7 @@ class fulltext_native extends \phpbb\search\base unset($sql_in); } - if (sizeof($destroy_cache_words)) + if (count($destroy_cache_words)) { // destroy cached search results containing any of the words that are now common or were removed $this->destroy_cache(array_unique($destroy_cache_words)); @@ -1685,7 +1685,7 @@ class fulltext_native extends \phpbb\search\base */ public function index_created() { - if (!sizeof($this->stats)) + if (!count($this->stats)) { $this->get_stats(); } @@ -1698,7 +1698,7 @@ class fulltext_native extends \phpbb\search\base */ public function index_stats() { - if (!sizeof($this->stats)) + if (!count($this->stats)) { $this->get_stats(); } diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index 8dbc7212a1..4fe7e3b88d 100644 --- a/phpBB/phpbb/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php @@ -294,7 +294,7 @@ class fulltext_postgres extends \phpbb\search\base // remove too short or too long words $text = array_values($text); - for ($i = 0, $n = sizeof($text); $i < $n; $i++) + for ($i = 0, $n = count($text); $i < $n; $i++) { $text[$i] = trim($text[$i]); if (utf8_strlen($text[$i]) < $this->config['fulltext_postgres_min_word_len'] || utf8_strlen($text[$i]) > $this->config['fulltext_postgres_max_word_len']) @@ -502,12 +502,12 @@ class fulltext_postgres extends \phpbb\search\base $sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : ''; $field = ($type == 'posts') ? 'post_id' : 'topic_id'; - if (sizeof($author_ary) && $author_name) + if (count($author_ary) && $author_name) { // first one matches post of registered users, second one guests and deleted users $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; } - else if (sizeof($author_ary)) + else if (count($author_ary)) { $sql_author = ' AND ' . $this->db->sql_in_set('p.poster_id', $author_ary); } @@ -519,7 +519,7 @@ class fulltext_postgres extends \phpbb\search\base $sql_where_options = $sql_sort_join; $sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : ''; $sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : ''; - $sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_where_options .= (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; $sql_where_options .= ' AND ' . $post_visibility; $sql_where_options .= $sql_author; $sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; @@ -609,7 +609,7 @@ class fulltext_postgres extends \phpbb\search\base public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) { // No author? No posts - if (!sizeof($author_ary)) + if (!count($author_ary)) { return 0; } @@ -686,7 +686,7 @@ class fulltext_postgres extends \phpbb\search\base { $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); } - $sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; $sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; $sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : ''; @@ -861,7 +861,7 @@ class fulltext_postgres extends \phpbb\search\base $id_ary = array_unique($id_ary); } - if (sizeof($id_ary)) + if (count($id_ary)) { $this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir); $id_ary = array_slice($id_ary, 0, $per_page); diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index 89c615e087..011c41bfd4 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -482,7 +482,7 @@ class fulltext_sphinx global $user, $phpbb_log; // No keywords? No posts. - if (!strlen($this->search_query) && !sizeof($author_ary)) + if (!strlen($this->search_query) && !count($author_ary)) { return false; } @@ -622,7 +622,7 @@ class fulltext_sphinx break; } - if (sizeof($author_ary)) + if (count($author_ary)) { $this->sphinx->SetFilter('poster_id', $author_ary); } @@ -632,14 +632,14 @@ class fulltext_sphinx // but at least it will also cause the same for normal users. $this->sphinx->SetFilter('post_visibility', array(ITEM_APPROVED)); - if (sizeof($ex_fid_ary)) + if (count($ex_fid_ary)) { // All forums that a user is allowed to access $fid_ary = array_unique(array_intersect(array_keys($this->auth->acl_getf('f_read', true)), array_keys($this->auth->acl_getf('f_search', true)))); // All forums that the user wants to and can search in $search_forums = array_diff($fid_ary, $ex_fid_ary); - if (sizeof($search_forums)) + if (count($search_forums)) { $this->sphinx->SetFilter('forum_id', $search_forums); } @@ -789,7 +789,7 @@ class fulltext_sphinx } $this->db->sql_freeresult($result); - if (sizeof($post_updates)) + if (count($post_updates)) { $this->sphinx->UpdateAttributes($this->indexes, array('topic_last_post_time'), $post_updates); } diff --git a/phpBB/phpbb/search/sphinx/config.php b/phpBB/phpbb/search/sphinx/config.php index 675649b460..3205574b45 100644 --- a/phpBB/phpbb/search/sphinx/config.php +++ b/phpBB/phpbb/search/sphinx/config.php @@ -46,7 +46,7 @@ class config */ function get_section_by_name($name) { - for ($i = 0, $size = sizeof($this->sections); $i < $size; $i++) + for ($i = 0, $size = count($this->sections); $i < $size; $i++) { // Make sure this is really a section object and not a comment if (($this->sections[$i] instanceof \phpbb\search\sphinx\config_section) && $this->sections[$i]->get_name() == $name) @@ -67,7 +67,7 @@ class config function add_section($name) { $this->sections[] = new \phpbb\search\sphinx\config_section($name, ''); - return $this->sections[sizeof($this->sections) - 1]; + return $this->sections[count($this->sections) - 1]; } /** diff --git a/phpBB/phpbb/search/sphinx/config_section.php b/phpBB/phpbb/search/sphinx/config_section.php index 14ab3a752c..2fc8b2da17 100644 --- a/phpBB/phpbb/search/sphinx/config_section.php +++ b/phpBB/phpbb/search/sphinx/config_section.php @@ -87,7 +87,7 @@ class config_section */ function get_variable_by_name($name) { - for ($i = 0, $size = sizeof($this->variables); $i < $size; $i++) + for ($i = 0, $size = count($this->variables); $i < $size; $i++) { // Make sure this is a variable object and not a comment if (($this->variables[$i] instanceof \phpbb\search\sphinx\config_variable) && $this->variables[$i]->get_name() == $name) @@ -106,7 +106,7 @@ class config_section */ function delete_variables_by_name($name) { - for ($i = 0, $size = sizeof($this->variables); $i < $size; $i++) + for ($i = 0, $size = count($this->variables); $i < $size; $i++) { // Make sure this is a variable object and not a comment if (($this->variables[$i] instanceof \phpbb\search\sphinx\config_variable) && $this->variables[$i]->get_name() == $name) @@ -129,7 +129,7 @@ class config_section function create_variable($name, $value) { $this->variables[] = new \phpbb\search\sphinx\config_variable($name, $value, ''); - return $this->variables[sizeof($this->variables) - 1]; + return $this->variables[count($this->variables) - 1]; } /** diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index f0e716d697..1aa7717470 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -146,7 +146,7 @@ class extension extends \Twig_Extension // of items to grab (length) // Start must always be the actual starting number for this calculation (not negative) - $start = ($start < 0) ? sizeof($item) + $start : $start; + $start = ($start < 0) ? count($item) + $start : $start; $end = $end - $start; } diff --git a/phpBB/phpbb/tree/nestedset.php b/phpBB/phpbb/tree/nestedset.php index 7149513fd9..c02deaebf4 100644 --- a/phpBB/phpbb/tree/nestedset.php +++ b/phpBB/phpbb/tree/nestedset.php @@ -706,7 +706,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface { $acquired_new_lock = $this->acquire_lock(); - $diff = sizeof($subset_items) * 2; + $diff = count($subset_items) * 2; $sql_subset_items = $this->db->sql_in_set($this->column_item_id, $subset_items); $sql_not_subset_items = $this->db->sql_in_set($this->column_item_id, $subset_items, true); @@ -746,7 +746,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface */ protected function prepare_adding_subset(array $subset_items, array $new_parent) { - $diff = sizeof($subset_items) * 2; + $diff = count($subset_items) * 2; $sql_not_subset_items = $this->db->sql_in_set($this->column_item_id, $subset_items, true); $set_left_id = $this->db->sql_case($this->column_left_id . ' > ' . (int) $new_parent[$this->column_right_id], $this->column_left_id . ' + ' . $diff, $this->column_left_id); diff --git a/phpBB/phpbb/user_loader.php b/phpBB/phpbb/user_loader.php index cdd28329db..294f5208d5 100644 --- a/phpBB/phpbb/user_loader.php +++ b/phpBB/phpbb/user_loader.php @@ -75,7 +75,7 @@ class user_loader // Do not load users we already have in $this->users $user_ids = array_diff($user_ids, array_keys($this->users)); - if (sizeof($user_ids)) + if (count($user_ids)) { $sql = 'SELECT * FROM ' . $this->users_table . ' diff --git a/phpBB/posting.php b/phpBB/posting.php index 5dc59fea6d..777366c177 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -560,7 +560,7 @@ if ($mode == 'edit') ); } -$orig_poll_options_size = sizeof($post_data['poll_options']); +$orig_poll_options_size = count($post_data['poll_options']); $message_parser = new parse_message(); /* @var $plupload \phpbb\plupload\plupload */ @@ -863,7 +863,7 @@ if ($submit || $preview || $refresh) } // Delete Poll - if ($poll_delete && $mode == 'edit' && sizeof($post_data['poll_options']) && + if ($poll_delete && $mode == 'edit' && count($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))) { if ($submit && check_form_key('posting')) @@ -1013,7 +1013,7 @@ if ($submit || $preview || $refresh) // Parse message if ($update_message) { - if (sizeof($message_parser->warn_msg)) + if (count($message_parser->warn_msg)) { $error[] = implode('
', $message_parser->warn_msg); $message_parser->warn_msg = array(); @@ -1025,7 +1025,7 @@ if ($submit || $preview || $refresh) } // On a refresh we do not care about message parsing errors - if (sizeof($message_parser->warn_msg) && $refresh && !$preview) + if (count($message_parser->warn_msg) && $refresh && !$preview) { $message_parser->warn_msg = array(); } @@ -1247,7 +1247,7 @@ if ($submit || $preview || $refresh) } } - if (sizeof($message_parser->warn_msg)) + if (count($message_parser->warn_msg)) { $error[] = implode('
', $message_parser->warn_msg); } @@ -1292,7 +1292,7 @@ if ($submit || $preview || $refresh) extract($phpbb_dispatcher->trigger_event('core.posting_modify_submission_errors', compact($vars))); // Store message, sync counters - if (!sizeof($error) && $submit) + if (!count($error) && $submit) { if ($submit) { @@ -1489,7 +1489,7 @@ if ($submit || $preview || $refresh) } // Preview -if (!sizeof($error) && $preview) +if (!count($error) && $preview) { $post_data['post_time'] = ($mode == 'edit') ? $post_data['post_time'] : $current_time; @@ -1531,7 +1531,7 @@ if (!sizeof($error) && $preview) } $template->assign_vars(array( - 'S_HAS_POLL_OPTIONS' => (sizeof($post_data['poll_options'])), + 'S_HAS_POLL_OPTIONS' => (count($post_data['poll_options'])), 'S_IS_MULTI_CHOICE' => ($post_data['poll_max_options'] > 1) ? true : false, 'POLL_QUESTION' => $parse_poll->message, @@ -1560,7 +1560,7 @@ if (!sizeof($error) && $preview) } // Attachment Preview - if (sizeof($message_parser->attachment_data)) + if (count($message_parser->attachment_data)) { $template->assign_var('S_HAS_ATTACHMENTS', true); @@ -1578,7 +1578,7 @@ if (!sizeof($error) && $preview) unset($attachment_data); } - if (!sizeof($error)) + if (!count($error)) { $template->assign_vars(array( 'PREVIEW_SUBJECT' => $preview_subject, @@ -1601,7 +1601,7 @@ if ($generate_quote && $config['max_quote_depth'] > 0) } // Decode text for message display -$post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !sizeof($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid; +$post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !count($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid; $message_parser->decode_message($post_data['bbcode_uid']); if ($generate_quote) @@ -1649,7 +1649,7 @@ $attachment_data = $message_parser->attachment_data; $filename_data = $message_parser->filename_data; $post_data['post_text'] = $message_parser->message; -if (sizeof($post_data['poll_options']) || (isset($post_data['poll_title']) && !$bbcode_utils->is_empty($post_data['poll_title']))) +if (count($post_data['poll_options']) || (isset($post_data['poll_title']) && !$bbcode_utils->is_empty($post_data['poll_title']))) { $message_parser->message = $post_data['poll_title']; $message_parser->bbcode_uid = $post_data['bbcode_uid']; @@ -1774,7 +1774,7 @@ $page_data = array( 'FORUM_NAME' => $post_data['forum_name'], 'FORUM_DESC' => ($post_data['forum_desc']) ? generate_text_for_display($post_data['forum_desc'], $post_data['forum_desc_uid'], $post_data['forum_desc_bitfield'], $post_data['forum_desc_options']) : '', 'TOPIC_TITLE' => censor_text($post_data['topic_title']), - 'MODERATORS' => (sizeof($moderators)) ? implode($user->lang['COMMA_SEPARATOR'], $moderators[$forum_id]) : '', + 'MODERATORS' => (count($moderators)) ? implode($user->lang['COMMA_SEPARATOR'], $moderators[$forum_id]) : '', 'USERNAME' => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '', 'SUBJECT' => $post_data['post_subject'], 'MESSAGE' => $post_data['post_text'], @@ -1786,7 +1786,7 @@ $page_data = array( 'MAX_FONT_SIZE' => (int) $config['max_post_font_size'], 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), 'POST_DATE' => ($post_data['post_time']) ? $user->format_date($post_data['post_time']) : '', - 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'ERROR' => (count($error)) ? implode('
', $error) : '', 'TOPIC_TIME_LIMIT' => (int) $post_data['topic_time_limit'], 'EDIT_REASON' => $request->variable('edit_reason', '', true), 'SHOW_PANEL' => $request->variable('show_panel', ''), @@ -1846,7 +1846,7 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_ $page_data = array_merge($page_data, array( 'S_SHOW_POLL_BOX' => true, 'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id)), - 'S_POLL_DELETE' => ($mode == 'edit' && sizeof($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))), + 'S_POLL_DELETE' => ($mode == 'edit' && count($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))), 'S_POLL_DELETE_CHECKED' => (!empty($poll_delete)) ? true : false, 'L_POLL_OPTIONS_EXPLAIN' => $user->lang('POLL_OPTIONS_' . (($mode == 'edit') ? 'EDIT_' : '') . 'EXPLAIN', (int) $config['max_poll_options']), diff --git a/phpBB/search.php b/phpBB/search.php index 7bc41e5b40..f988732b14 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -203,7 +203,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $sql_author_match = (strpos($author, '*') !== false) ? ' ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; } - if (!sizeof($author_id_ary)) + if (!count($author_id_ary)) { trigger_error('NO_SEARCH_RESULTS'); } @@ -225,7 +225,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } // Which forums should not be searched? Author searches are also carried out in unindexed forums - if (empty($keywords) && sizeof($author_id_ary)) + if (empty($keywords) && count($author_id_ary)) { $ex_fid_ary = array_keys($auth->acl_getf('!f_read', true)); } @@ -234,7 +234,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $ex_fid_ary = array_unique(array_merge(array_keys($auth->acl_getf('!f_read', true)), array_keys($auth->acl_getf('!f_search', true)))); } - $not_in_fid = (sizeof($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : ""; + $not_in_fid = (count($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : ""; $sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.right_id, f.forum_password, f.forum_flags, fa.user_id FROM ' . FORUMS_TABLE . ' f @@ -261,7 +261,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) continue; } - if (sizeof($search_forum)) + if (count($search_forum)) { if ($search_child) { @@ -314,9 +314,9 @@ if ($keywords || $author || $author_id || $search_id || $submit) { $correct_query = $search->split_keywords($keywords, $search_terms); $common_words = $search->get_common_words(); - if (!$correct_query || (!$search->get_search_query() && !sizeof($author_id_ary) && !$search_id)) + if (!$correct_query || (!$search->get_search_query() && !count($author_id_ary) && !$search_id)) { - $ignored = (sizeof($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '
' : ''; + $ignored = (count($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '
' : ''; $word_length = $search->get_word_length(); if ($word_length) { @@ -329,7 +329,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } } - if (!$keywords && sizeof($author_id_ary)) + if (!$keywords && count($author_id_ary)) { // if it is an author search we want to show topics by default $show_results = ($topic_id) ? 'posts' : $request->variable('sr', ($search_id == 'egosearch') ? 'topics' : 'posts'); @@ -389,7 +389,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) WHERE t.topic_moved_id = 0 $last_post_time_sql AND " . $m_approve_topics_fid_sql . ' - ' . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . ' + ' . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . ' ORDER BY t.topic_last_post_time DESC'; $field = 'topic_id'; break; @@ -427,7 +427,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) AND p.topic_id = t.topic_id $last_post_time AND $m_approve_posts_fid_sql - " . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " + " . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " $sql_sort"; $field = 'post_id'; } @@ -440,7 +440,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) AND p.topic_id = t.topic_id $last_post_time AND $m_approve_topics_fid_sql - " . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " + " . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " $sql_sort"; $field = 'topic_id'; } @@ -456,7 +456,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $sql_where = 'AND t.topic_moved_id = 0 AND ' . $m_approve_topics_fid_sql . ' - ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : ''); + ' . ((count($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : ''); gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; @@ -482,7 +482,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) FROM ' . POSTS_TABLE . ' p WHERE p.post_time > ' . $user->data['user_lastvisit'] . ' AND ' . $m_approve_posts_fid_sql . ' - ' . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " + ' . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " $sql_sort"; $field = 'post_id'; } @@ -493,7 +493,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) WHERE t.topic_last_post_time > ' . $user->data['user_lastvisit'] . ' AND t.topic_moved_id = 0 AND ' . $m_approve_topics_fid_sql . ' - ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " + ' . ((count($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " $sql_sort"; /* [Fix] queued replies missing from "view new posts" (Bug #42705 - Patch by Paul) @@ -567,7 +567,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $search_id = ''; } - $total_match_count = sizeof($id_ary); + $total_match_count = count($id_ary); if ($total_match_count) { // Limit the number to $total_matches_limit for pre-made searches @@ -597,7 +597,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) { $total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); } - else if (sizeof($author_id_ary)) + else if (count($author_id_ary)) { $firstpost_only = ($search_fields === 'firstpost' || $search_fields == 'titleonly') ? true : false; $total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); @@ -647,10 +647,10 @@ if ($keywords || $author || $author_id || $search_id || $submit) $sql_where = ''; - if (sizeof($id_ary)) + if (count($id_ary)) { $sql_where .= $db->sql_in_set(($show_results == 'posts') ? 'p.post_id' : 't.topic_id', $id_ary); - $sql_where .= (sizeof($ex_fid_ary)) ? ' AND (' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . ' OR f.forum_id IS NULL)' : ''; + $sql_where .= (count($ex_fid_ary)) ? ' AND (' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . ' OR f.forum_id IS NULL)' : ''; $sql_where .= ' AND ' . (($show_results == 'posts') ? $m_approve_posts_fid_sql : $m_approve_topics_fid_sql); } @@ -888,7 +888,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $db->sql_freeresult($result); // If we have some shadow topics, update the rowset to reflect their topic information - if (sizeof($shadow_topic_list)) + if (count($shadow_topic_list)) { $sql = 'SELECT * FROM ' . TOPICS_TABLE . ' @@ -972,7 +972,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) unset($text_only_message); // Pull attachment data - if (sizeof($attach_list)) + if (count($attach_list)) { $use_attach_list = $attach_list; $attach_list = array(); @@ -986,7 +986,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } } - if (sizeof($attach_list)) + if (count($attach_list)) { $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index dff965a1ee..a9566c08cb 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -385,7 +385,7 @@ $template->assign_vars(array( 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, - 'S_TOPIC_ICONS' => ($s_display_active && sizeof($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false), + 'S_TOPIC_ICONS' => ($s_display_active && count($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false), 'U_WATCH_FORUM_LINK' => $s_watching_forum['link'], 'U_WATCH_FORUM_TOGGLE' => $s_watching_forum['link_toggle'], 'S_WATCH_FORUM_TITLE' => $s_watching_forum['title'], @@ -395,7 +395,7 @@ $template->assign_vars(array( 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx"), 'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), - 'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && sizeof($moderators[$forum_id]) > 1) ? false : true, + 'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && count($moderators[$forum_id]) > 1) ? false : true, 'S_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false, 'S_VIEWFORUM' => true, @@ -465,7 +465,7 @@ if ($user->data['is_registered']) $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id']); $sql_array['SELECT'] .= ', tt.mark_time'; - if ($s_display_active && sizeof($active_forum_ary)) + if ($s_display_active && count($active_forum_ary)) { $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id']); $sql_array['SELECT'] .= ', ft.mark_time AS forum_mark_time'; @@ -573,8 +573,8 @@ if ($start > $topics_count / 2) // Select the sort order $direction = (($sort_dir == 'd') ? 'ASC' : 'DESC'); - $sql_limit = $pagination->reverse_limit($start, $sql_limit, $topics_count - sizeof($announcement_list)); - $sql_start = $pagination->reverse_start($start, $sql_limit, $topics_count - sizeof($announcement_list)); + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $topics_count - count($announcement_list)); + $sql_start = $pagination->reverse_start($start, $sql_limit, $topics_count - count($announcement_list)); } else { @@ -592,7 +592,7 @@ else $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; } -if ($forum_data['forum_type'] == FORUM_POST || !sizeof($active_forum_ary)) +if ($forum_data['forum_type'] == FORUM_POST || !count($active_forum_ary)) { $sql_where = 't.forum_id = ' . $forum_id; } @@ -603,7 +603,7 @@ else if (empty($active_forum_ary['exclude_forum_id'])) else { $get_forum_ids = array_diff($active_forum_ary['forum_id'], $active_forum_ary['exclude_forum_id']); - $sql_where = (sizeof($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id; + $sql_where = (count($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id; } // Grab just the sorted topic ids @@ -662,7 +662,7 @@ $db->sql_freeresult($result); // For storing shadow topics $shadow_topic_list = array(); -if (sizeof($topic_list)) +if (count($topic_list)) { // SQL array for obtaining topics/stickies $sql_array = array( @@ -692,7 +692,7 @@ if (sizeof($topic_list)) } // If we have some shadow topics, update the rowset to reflect their topic information -if (sizeof($shadow_topic_list)) +if (count($shadow_topic_list)) { // SQL array for obtaining shadow topics $sql_array = array( @@ -767,7 +767,7 @@ if ($s_display_active) // We need to remove the global announcements from the forums total topic count, // otherwise the number is different from the one on the forum list -$total_topic_count = $topics_count - sizeof($announcement_list); +$total_topic_count = $topics_count - count($announcement_list); $base_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '')); $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_topic_count, $config['topics_per_page'], $start); @@ -794,7 +794,7 @@ $vars = array('topic_list', 'rowset', 'total_topic_count', 'forum_id'); extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topics_data', compact($vars))); // Okay, lets dump out the page ... -if (sizeof($topic_list)) +if (count($topic_list)) { $mark_forum_read = true; $mark_time_forum = 0; @@ -997,7 +997,7 @@ if (sizeof($topic_list)) // on all topics (as we do in 2.0.x). It looks for unread or new topics, if it doesn't find // any it updates the forum last read cookie. This requires that the user visit the forum // after reading a topic -if ($forum_data['forum_type'] == FORUM_POST && sizeof($topic_list) && $mark_forum_read) +if ($forum_data['forum_type'] == FORUM_POST && count($topic_list) && $mark_forum_read) { update_forum_tracking_info($forum_id, $forum_data['forum_last_post_time'], false, $mark_time_forum); } diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index d4bf5b2490..6513388bc5 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -32,7 +32,7 @@ $topic_id = $request->variable('t', 0); $post_id = $request->variable('p', 0); $voted_id = $request->variable('vote_id', array('' => 0)); -$voted_id = (sizeof($voted_id) > 1) ? array_unique($voted_id) : $voted_id; +$voted_id = (count($voted_id) > 1) ? array_unique($voted_id) : $voted_id; $start = $request->variable('start', 0); @@ -736,7 +736,7 @@ $template->assign_vars(array( 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts), 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', - 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '', + 'MODERATORS' => (isset($forum_moderators[$forum_id]) && count($forum_moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '', 'POST_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'), 'QUOTE_IMG' => $user->img('icon_post_quote', 'REPLY_WITH_QUOTE'), @@ -759,7 +759,7 @@ $template->assign_vars(array( 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, - 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1) ? false : true, + 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && count($forum_moderators[$forum_id]) > 1) ? false : true, 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")), 'S_MOD_ACTION' => $s_quickmod_action, @@ -852,9 +852,9 @@ if (!empty($topic_data['poll_start'])) (($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) && $topic_data['topic_status'] != ITEM_LOCKED && $topic_data['forum_status'] != ITEM_LOCKED && - (!sizeof($cur_voted_id) || + (!count($cur_voted_id) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']))) ? true : false; - $s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($cur_voted_id)) || $view == 'viewpoll') ? true : false; + $s_display_results = (!$s_can_vote || ($s_can_vote && count($cur_voted_id)) || $view == 'viewpoll') ? true : false; /** * Event to manipulate the poll data @@ -889,16 +889,16 @@ if (!empty($topic_data['poll_start'])) if ($update && $s_can_vote) { - if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting')) + if (!count($voted_id) || count($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting')) { $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")); meta_refresh(5, $redirect_url); - if (!sizeof($voted_id)) + if (!count($voted_id)) { $message = 'NO_VOTE_OPTION'; } - else if (sizeof($voted_id) > $topic_data['poll_max_options']) + else if (count($voted_id) > $topic_data['poll_max_options']) { $message = 'TOO_MANY_VOTE_OPTIONS'; } @@ -992,7 +992,7 @@ if (!empty($topic_data['poll_start'])) 'user_votes' => array_flip($valid_user_votes), 'vote_counts' => $vote_counts, 'total_votes' => array_sum($vote_counts), - 'can_vote' => !sizeof($valid_user_votes) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']), + 'can_vote' => !count($valid_user_votes) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']), ); $json_response = new \phpbb\json_response(); $json_response->send($data); @@ -1012,7 +1012,7 @@ if (!empty($topic_data['poll_start'])) $parse_flags = ($poll_info[0]['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; - for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++) + for ($i = 0, $size = count($poll_info); $i < $size; $i++) { $poll_info[$i]['poll_option_text'] = generate_text_for_display($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield'], $parse_flags, true); } @@ -1154,7 +1154,7 @@ while ($row = $db->sql_fetchrow($result)) } $db->sql_freeresult($result); -if (!sizeof($post_list)) +if (!count($post_list)) { if ($sort_days) { @@ -1478,7 +1478,7 @@ if ($config['load_cpf_viewtopic']) } // Generate online information for user -if ($config['load_onlinetrack'] && sizeof($id_cache)) +if ($config['load_onlinetrack'] && count($id_cache)) { $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline FROM ' . SESSIONS_TABLE . ' @@ -1496,7 +1496,7 @@ if ($config['load_onlinetrack'] && sizeof($id_cache)) unset($id_cache); // Pull attachment data -if (sizeof($attach_list)) +if (count($attach_list)) { if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) { @@ -1514,7 +1514,7 @@ if (sizeof($attach_list)) $db->sql_freeresult($result); // No attachments exist, but post table thinks they do so go ahead and reset post_attach flags - if (!sizeof($attachments)) + if (!count($attachments)) { $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_attachment = 0 @@ -1522,7 +1522,7 @@ if (sizeof($attach_list)) $db->sql_query($sql); // We need to update the topic indicator too if the complete topic is now without an attachment - if (sizeof($rowset) != $total_posts) + if (count($rowset) != $total_posts) { // Not all posts are displayed so we query the db to find if there's any attachment for this topic $sql = 'SELECT a.post_msg_id as post_id @@ -1579,12 +1579,12 @@ $can_receive_pm_list = (empty($can_receive_pm_list) || !isset($can_receive_pm_li // Get the list of permanently banned users $permanently_banned_users = phpbb_get_banned_user_ids(array_keys($user_cache), false); -$i_total = sizeof($rowset) - 1; +$i_total = count($rowset) - 1; $prev_post_id = ''; $template->assign_vars(array( 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'], - 'S_NUM_POSTS' => sizeof($post_list)) + 'S_NUM_POSTS' => count($post_list)) ); /** @@ -1629,7 +1629,7 @@ extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_data', comp // Output the posts $first_unread = $post_unread = false; -for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) +for ($i = 0, $end = count($post_list); $i < $end; ++$i) { // A non-existing rowset only happens if there was no user present for the entered poster_id // This could be a broken posts table. @@ -1672,7 +1672,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason']) { // Get usernames for all following posts if not already stored - if (!sizeof($post_edit_list) && ($row['post_edit_reason'] || ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']])))) + if (!count($post_edit_list) && ($row['post_edit_reason'] || ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']])))) { // Remove all post_ids already parsed (we do not have to check them) $post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i); @@ -1736,7 +1736,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) if ($row['post_visibility'] == ITEM_DELETED && $row['post_delete_user']) { // Get usernames for all following posts if not already stored - if (!sizeof($post_delete_list) && ($row['post_delete_reason'] || ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']])))) + if (!count($post_delete_list) && ($row['post_delete_reason'] || ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']])))) { // Remove all post_ids already parsed (we do not have to check them) $post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i); @@ -1979,7 +1979,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, - 'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1, + 'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && count($attachments[$row['post_id']]) > 1, 'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) ? true : false, 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false, 'L_POST_DELETED_MESSAGE' => $l_deleted_message, @@ -1988,7 +1988,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_FRIEND' => ($row['friend']) ? true : false, 'S_UNREAD_POST' => $post_unread, 'S_FIRST_UNREAD' => $s_first_unread, - 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false, + 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false, 'S_TOPIC_POSTER' => ($topic_data['topic_poster'] == $poster_id) ? true : false, 'S_IGNORE_POST' => ($row['foe']) ? true : false, @@ -2039,7 +2039,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $i = $current_row_number; - if (isset($cp_row['row']) && sizeof($cp_row['row'])) + if (isset($cp_row['row']) && count($cp_row['row'])) { $post_row = array_merge($post_row, $cp_row['row']); } @@ -2152,7 +2152,7 @@ if (isset($user->data['session_page']) && !$user->data['is_bot'] && (strpos($use $db->sql_query($sql); // Update the attachment download counts - if (sizeof($update_count)) + if (count($update_count)) { $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET download_count = download_count + 1 diff --git a/tests/cache/cache_memory_test.php b/tests/cache/cache_memory_test.php index 9f92e8d8dc..ba1010bcf3 100644 --- a/tests/cache/cache_memory_test.php +++ b/tests/cache/cache_memory_test.php @@ -116,7 +116,7 @@ class phpbb_cache_memory_test extends phpbb_database_test_case $results[] = $row; } $this->cache->sql_freeresult($query_id); - $this->assertEquals($query[1], sizeof($results)); + $this->assertEquals($query[1], count($results)); } $this->cache->destroy('sql', $table); diff --git a/tests/cron/manager_test.php b/tests/cron/manager_test.php index a58a22c8a0..610f662b7d 100644 --- a/tests/cron/manager_test.php +++ b/tests/cron/manager_test.php @@ -40,7 +40,7 @@ class phpbb_cron_manager_test extends \phpbb_test_case public function test_manager_finds_all_ready_tasks() { $tasks = $this->manager->find_all_ready_tasks(); - $this->assertEquals(3, sizeof($tasks)); + $this->assertEquals(3, count($tasks)); } public function test_manager_finds_one_ready_task() diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php index 98709fb043..4fa5cc37a2 100644 --- a/tests/dbal/write_test.php +++ b/tests/dbal/write_test.php @@ -67,7 +67,7 @@ class phpbb_dbal_write_test extends phpbb_database_test_case $result = $db->sql_query($sql); $rows = $db->sql_fetchrowset($result); - $this->assertEquals(1, sizeof($rows)); + $this->assertEquals(1, count($rows)); $this->assertEquals('config2', $rows[0]['config_name']); $db->sql_freeresult($result); diff --git a/tests/event/md_exporter_test.php b/tests/event/md_exporter_test.php index 607f442fdf..2eeb48ea05 100644 --- a/tests/event/md_exporter_test.php +++ b/tests/event/md_exporter_test.php @@ -92,7 +92,7 @@ class phpbb_event_md_exporter_test extends phpbb_test_case public function test_crawl_eventsmd($file, $min_version, $max_version, $events) { $exporter = new \phpbb\event\md_exporter(dirname(__FILE__) . '/fixtures/', null, $min_version, $max_version); - $this->assertSame(sizeof($events), $exporter->crawl_eventsmd($file, 'adm')); + $this->assertSame(count($events), $exporter->crawl_eventsmd($file, 'adm')); $this->assertEquals($events, $exporter->get_events()); } @@ -146,7 +146,7 @@ class phpbb_event_md_exporter_test extends phpbb_test_case $exporter->crawl_eventsmd('docs/events.md', $filter); $events = $exporter->crawl_file_for_events($file); - $this->assertGreaterThanOrEqual(0, sizeof($events)); + $this->assertGreaterThanOrEqual(0, count($events)); $this->assertTrue($exporter->validate_events_from_file($file, $events)); } } diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php index a263394bbe..4fced5700a 100644 --- a/tests/functional/fileupload_remote_test.php +++ b/tests/functional/fileupload_remote_test.php @@ -102,7 +102,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case ->set_allowed_extensions(array('gif')) ->set_max_filesize(2000); $file = $upload->handle_upload('files.types.remote', self::$root_url . 'develop/test.gif'); - $this->assertEquals(0, sizeof($file->error)); + $this->assertEquals(0, count($file->error)); $this->assertTrue(file_exists($file->get('filename'))); $this->assertTrue($file->is_uploaded()); } @@ -115,7 +115,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case ->set_allowed_extensions(array('gif')) ->set_max_filesize(100); $file = $upload->handle_upload('files.types.remote', self::$root_url . 'develop/test.gif'); - $this->assertEquals(1, sizeof($file->error)); + $this->assertEquals(1, count($file->error)); $this->assertEquals('WRONG_FILESIZE', $file->error[0]); } } diff --git a/tests/functions/get_remote_file_test.php b/tests/functions/get_remote_file_test.php index 1550aa37e6..75e5a6dc61 100644 --- a/tests/functions/get_remote_file_test.php +++ b/tests/functions/get_remote_file_test.php @@ -58,7 +58,7 @@ class phpbb_functions_get_remote_file extends phpbb_test_case $this->assertGreaterThanOrEqual( 2, - sizeof($lines), + count($lines), 'Failed asserting that the version file has at least two lines.' ); diff --git a/tests/mock/sql_insert_buffer.php b/tests/mock/sql_insert_buffer.php index c751764d45..e57983684d 100644 --- a/tests/mock/sql_insert_buffer.php +++ b/tests/mock/sql_insert_buffer.php @@ -15,7 +15,7 @@ class phpbb_mock_sql_insert_buffer extends \phpbb\db\sql_insert_buffer { public function flush() { - return (sizeof($this->buffer)) ? true : false; + return (count($this->buffer)) ? true : false; } public function get_buffer() diff --git a/tests/notification/base.php b/tests/notification/base.php index b64e25cf8c..80b9a0d777 100644 --- a/tests/notification/base.php +++ b/tests/notification/base.php @@ -163,7 +163,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case 'order_dir' => 'ASC', ), $options)); - $this->assertEquals(sizeof($expected), $notifications['unread_count']); + $this->assertEquals(count($expected), $notifications['unread_count']); $i = 0; foreach ($notifications['notifications'] as $notification) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index b7386e9a3e..df7c669865 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -229,7 +229,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test { // http://stackoverflow.com/questions/3838288/phpunit-assert-two-arrays-are-equal-but-order-of-elements-not-important // but one array_diff is not enough! - if (sizeof(array_diff($one, $two)) || sizeof(array_diff($two, $one))) + if (count(array_diff($one, $two)) || count(array_diff($two, $one))) { // get a nice error message $this->assertEquals($one, $two); diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index 147029d699..b58e9c752b 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -621,7 +621,7 @@ class phpbb_database_test_connection_manager } // Combine all of the SETVALs into one query - if (sizeof($setval_queries)) + if (count($setval_queries)) { $queries[] = 'SELECT ' . implode(', ', $setval_queries); } diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 8b0edf2cdd..cdf9174b02 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -425,7 +425,7 @@ class phpbb_functional_test_case extends phpbb_test_case $meta_refresh = $crawler->filter('meta[http-equiv="refresh"]'); // Wait for extension to be fully enabled - while (sizeof($meta_refresh)) + while (count($meta_refresh)) { preg_match('#url=.+/(adm+.+)#', $meta_refresh->attr('content'), $match); $url = $match[1]; @@ -987,7 +987,7 @@ class phpbb_functional_test_case extends phpbb_test_case $this->assertEquals( 1, - sizeof($result), + count($result), $message ?: 'Failed asserting that exactly one checkbox with name' . " $name exists in crawler scope." ); diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index b875d3212b..d38d14f45c 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -317,7 +317,7 @@ class phpbb_ui_test_case extends phpbb_test_case $meta_refresh = $this->find_element('cssSelector', 'meta[http-equiv="refresh"]'); // Wait for extension to be fully enabled - while (sizeof($meta_refresh)) + while (count($meta_refresh)) { preg_match('#url=.+/(adm+.+)#', $meta_refresh->getAttribute('content'), $match); $this->getDriver()->execute(array('method' => 'post', 'url' => $match[1])); diff --git a/tests/upload/fileupload_test.php b/tests/upload/fileupload_test.php index b50c5291d4..84fc00bf98 100644 --- a/tests/upload/fileupload_test.php +++ b/tests/upload/fileupload_test.php @@ -173,7 +173,7 @@ class phpbb_fileupload_test extends phpbb_test_case ->set_max_filesize(1000); $file = $this->gen_valid_filespec(); $upload->common_checks($file); - $this->assertEquals(0, sizeof($file->error)); + $this->assertEquals(0, count($file->error)); } public function test_local_upload() @@ -184,7 +184,7 @@ class phpbb_fileupload_test extends phpbb_test_case copy($this->path . 'jpg', $this->path . 'jpg.jpg'); $file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg'); - $this->assertEquals(0, sizeof($file->error)); + $this->assertEquals(0, count($file->error)); $this->assertFalse($file->additional_checks()); $this->assertTrue($file->move_file('../tests/upload/fixture/copies', true)); $file->remove(); @@ -198,10 +198,10 @@ class phpbb_fileupload_test extends phpbb_test_case copy($this->path . 'jpg', $this->path . 'jpg.jpg'); $file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg'); - $this->assertEquals(0, sizeof($file->error)); + $this->assertEquals(0, count($file->error)); $this->assertFalse($file->move_file('../tests/upload/fixture')); $this->assertFalse($file->get('file_moved')); - $this->assertEquals(1, sizeof($file->error)); + $this->assertEquals(1, count($file->error)); } public function test_move_existent_file_overwrite() @@ -213,9 +213,9 @@ class phpbb_fileupload_test extends phpbb_test_case copy($this->path . 'jpg', $this->path . 'jpg.jpg'); copy($this->path . 'jpg', $this->path . 'copies/jpg.jpg'); $file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg'); - $this->assertEquals(0, sizeof($file->error)); + $this->assertEquals(0, count($file->error)); $file->move_file('../tests/upload/fixture/copies', true); - $this->assertEquals(0, sizeof($file->error)); + $this->assertEquals(0, count($file->error)); unlink($this->path . 'copies/jpg.jpg'); } diff --git a/tests/wrapper/version_compare_test.php b/tests/wrapper/version_compare_test.php index 8260d99504..ee23fe779c 100644 --- a/tests/wrapper/version_compare_test.php +++ b/tests/wrapper/version_compare_test.php @@ -66,7 +66,7 @@ class phpbb_wrapper_version_compare_test extends phpbb_test_case '3.2-A1', ); - for ($i = 0, $size = sizeof($releases); $i < $size - 1; ++$i) + for ($i = 0, $size = count($releases); $i < $size - 1; ++$i) { $version1 = $releases[$i]; $version2 = $releases[$i + 1]; From 765768f139b198186302ae37838f168432542029 Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 17 Jul 2017 18:35:43 +0700 Subject: [PATCH 11/11] [ticket/14972] Temporarily pull PHP nightly build out of allowed tests failures PHPBB3-14972 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6466c3bfb1..ec4e11c9fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,6 @@ matrix: env: DB=mysqli allow_failures: - php: hhvm - - php: nightly fast_finish: true addons:
', $categories), - 'USER_GROUPS_DEFAULT' => ($user_mode == 'user' && isset($user_groups_default[$ug_id]) && sizeof($user_groups_default[$ug_id])) ? implode($user->lang['COMMA_SEPARATOR'], $user_groups_default[$ug_id]) : '', - 'USER_GROUPS_CUSTOM' => ($user_mode == 'user' && isset($user_groups_custom[$ug_id]) && sizeof($user_groups_custom[$ug_id])) ? implode($user->lang['COMMA_SEPARATOR'], $user_groups_custom[$ug_id]) : '', + 'USER_GROUPS_DEFAULT' => ($user_mode == 'user' && isset($user_groups_default[$ug_id]) && count($user_groups_default[$ug_id])) ? implode($user->lang['COMMA_SEPARATOR'], $user_groups_default[$ug_id]) : '', + 'USER_GROUPS_CUSTOM' => ($user_mode == 'user' && isset($user_groups_custom[$ug_id]) && count($user_groups_custom[$ug_id])) ? implode($user->lang['COMMA_SEPARATOR'], $user_groups_custom[$ug_id]) : '', 'L_ACL_TYPE' => $l_acl_type, 'S_LOCAL' => ($local) ? true : false, 'S_GLOBAL' => (!$local) ? true : false, - 'S_NUM_CATS' => sizeof($categories), + 'S_NUM_CATS' => count($categories), 'S_VIEW' => ($mode == 'view') ? true : false, - 'S_NUM_OBJECTS' => sizeof($content_array), + 'S_NUM_OBJECTS' => count($content_array), 'S_USER_MODE' => ($user_mode == 'user') ? true : false, 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false) ); @@ -637,7 +637,7 @@ class auth_admin extends \phpbb\auth\auth global $db, $template, $user, $phpbb_root_path, $phpEx; global $phpbb_container; - if (!sizeof($hold_ary)) + if (!count($hold_ary)) { return; } @@ -669,7 +669,7 @@ class auth_admin extends \phpbb\auth\auth 'FORUM_ID' => $forum_id) ); - if (isset($auth_ary['users']) && sizeof($auth_ary['users'])) + if (isset($auth_ary['users']) && count($auth_ary['users'])) { $sql = 'SELECT user_id, username FROM ' . USERS_TABLE . ' @@ -688,7 +688,7 @@ class auth_admin extends \phpbb\auth\auth $db->sql_freeresult($result); } - if (isset($auth_ary['groups']) && sizeof($auth_ary['groups'])) + if (isset($auth_ary['groups']) && count($auth_ary['groups'])) { $sql = 'SELECT group_id, group_name, group_type FROM ' . GROUPS_TABLE . ' @@ -890,7 +890,7 @@ class auth_admin extends \phpbb\auth\auth } $db->sql_freeresult($result); - if (sizeof($role_ids)) + if (count($role_ids)) { $sql = "DELETE FROM $table WHERE $forum_sql @@ -1000,7 +1000,7 @@ class auth_admin extends \phpbb\auth\auth } // If no data is there, we set the any-flag to ACL_NEVER... - if (!sizeof($sql_ary)) + if (!count($sql_ary)) { $sql_ary[] = array( 'role_id' => (int) $role_id, @@ -1083,7 +1083,7 @@ class auth_admin extends \phpbb\auth\auth $db->sql_freeresult($result); // Get role data for resetting data - if (sizeof($cur_role_auth)) + if (count($cur_role_auth)) { $sql = 'SELECT ao.auth_option, rd.role_id, rd.auth_setting FROM ' . ACL_OPTIONS_TABLE . ' ao, ' . ACL_ROLES_DATA_TABLE . ' rd diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index e8492a82a3..6e40eef1d5 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -94,13 +94,13 @@ class bbcode ${$type}['replace'][] = $replace; } - if (sizeof($str['search'])) + if (count($str['search'])) { $message = str_replace($str['search'], $str['replace'], $message); $str = array('search' => array(), 'replace' => array()); } - if (sizeof($preg['search'])) + if (count($preg['search'])) { // we need to turn the entities back into their original form to allow the // search patterns to work properly @@ -191,7 +191,7 @@ class bbcode } } - if (sizeof($sql)) + if (count($sql)) { global $db; diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index d307880c4b..68c6c6e6a8 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -75,7 +75,7 @@ class diff { $count = 0; - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -98,7 +98,7 @@ class diff { $count = 0; - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -136,7 +136,7 @@ class diff $rev->_edits = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; $rev->_edits[] = $edit->reverse(); @@ -152,7 +152,7 @@ class diff */ function is_empty() { - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -168,8 +168,8 @@ class diff $final = $edit->final; // We can simplify one case where the array is usually supposed to be empty... - if (sizeof($orig) == 1 && trim($orig[0]) === '') $orig = array(); - if (sizeof($final) == 1 && trim($final[0]) === '') $final = array(); + if (count($orig) == 1 && trim($orig[0]) === '') $orig = array(); + if (count($final) == 1 && trim($final[0]) === '') $final = array(); if (!$orig && !$final) { @@ -196,13 +196,13 @@ class diff { $lcs = 0; - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; if (is_a($edit, 'diff_op_copy')) { - $lcs += sizeof($edit->orig); + $lcs += count($edit->orig); } } return $lcs; @@ -219,13 +219,13 @@ class diff { $lines = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; if ($edit->orig) { - array_splice($lines, sizeof($lines), 0, $edit->orig); + array_splice($lines, count($lines), 0, $edit->orig); } } return $lines; @@ -242,13 +242,13 @@ class diff { $lines = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; if ($edit->final) { - array_splice($lines, sizeof($lines), 0, $edit->final); + array_splice($lines, count($lines), 0, $edit->final); } } return $lines; @@ -296,7 +296,7 @@ class diff $prevtype = null; - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -332,7 +332,7 @@ class mapped_diff extends diff */ function mapped_diff(&$from_lines, &$to_lines, &$mapped_from_lines, &$mapped_to_lines) { - if (sizeof($from_lines) != sizeof($mapped_from_lines) || sizeof($to_lines) != sizeof($mapped_to_lines)) + if (count($from_lines) != count($mapped_from_lines) || count($to_lines) != count($mapped_to_lines)) { return false; } @@ -340,20 +340,20 @@ class mapped_diff extends diff parent::diff($mapped_from_lines, $mapped_to_lines); $xi = $yi = 0; - for ($i = 0; $i < sizeof($this->_edits); $i++) + for ($i = 0; $i < count($this->_edits); $i++) { $orig = &$this->_edits[$i]->orig; if (is_array($orig)) { - $orig = array_slice($from_lines, $xi, sizeof($orig)); - $xi += sizeof($orig); + $orig = array_slice($from_lines, $xi, count($orig)); + $xi += count($orig); } $final = &$this->_edits[$i]->final; if (is_array($final)) { - $final = array_slice($to_lines, $yi, sizeof($final)); - $yi += sizeof($final); + $final = array_slice($to_lines, $yi, count($final)); + $yi += count($final); } } } @@ -377,12 +377,12 @@ class diff_op function norig() { - return ($this->orig) ? sizeof($this->orig) : 0; + return ($this->orig) ? count($this->orig) : 0; } function nfinal() { - return ($this->final) ? sizeof($this->final) : 0; + return ($this->final) ? count($this->final) : 0; } } @@ -517,7 +517,7 @@ class diff3 extends diff { $conflicts = 0; - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -550,7 +550,7 @@ class diff3 extends diff $lines = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -590,7 +590,7 @@ class diff3 extends diff { $lines = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -614,7 +614,7 @@ class diff3 extends diff { $lines = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -638,7 +638,7 @@ class diff3 extends diff { $conflicts = array(); - for ($i = 0, $size = sizeof($this->_edits); $i < $size; $i++) + for ($i = 0, $size = count($this->_edits); $i < $size; $i++) { $edit = $this->_edits[$i]; @@ -803,9 +803,9 @@ class diff3_op function solve_prepare() { // We can simplify one case where the array is usually supposed to be empty... - if (sizeof($this->orig) == 1 && trim($this->orig[0]) === '') $this->orig = array(); - if (sizeof($this->final1) == 1 && trim($this->final1[0]) === '') $this->final1 = array(); - if (sizeof($this->final2) == 1 && trim($this->final2[0]) === '') $this->final2 = array(); + if (count($this->orig) == 1 && trim($this->orig[0]) === '') $this->orig = array(); + if (count($this->final1) == 1 && trim($this->final1[0]) === '') $this->final1 = array(); + if (count($this->final2) == 1 && trim($this->final2[0]) === '') $this->final2 = array(); // Now we only can have the case where the only difference between arrays are newlines, so compare all cases @@ -848,10 +848,10 @@ class diff3_op $_final1 = &$this->$final1; // Ok, we basically search for $orig in $final1 - $compare_seq = sizeof($_orig); + $compare_seq = count($_orig); // Go through the conflict code - for ($i = 0, $j = 0, $size = sizeof($_final1); $i < $size; $i++, $j = $i) + for ($i = 0, $j = 0, $size = count($_final1); $i < $size; $i++, $j = $i) { $line = $_final1[$i]; $skip = 0; @@ -895,7 +895,7 @@ class diff3_op // CASE ONE: orig changed into final2, but modified/unknown code in final1. // IF orig is found "as is" in final1 we replace the code directly in final1 and populate this as final2/merge - if (sizeof($this->orig) && sizeof($this->final2)) + if (count($this->orig) && count($this->final2)) { $result = $this->_compare_conflict_seq('orig', 'final1', 'final2'); @@ -915,7 +915,7 @@ class diff3_op } // Try to solve $Id$ issues. ;) - if (sizeof($this->orig) == 1 && sizeof($this->final1) == 1 && sizeof($this->final2) == 1) + if (count($this->orig) == 1 && count($this->final1) == 1 && count($this->final2) == 1) { $match = '#^' . preg_quote('* @version $Id: ', '#') . '[a-z\._\- ]+[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9\:Z]+ [a-z0-9_\- ]+\$$#'; @@ -939,9 +939,9 @@ class diff3_op } // The same is true for a line at the end. ;) - if (sizeof($this->orig) && sizeof($this->final2) && sizeof($this->orig) === sizeof($this->final2) && trim($this->orig[sizeof($this->orig)-1]) === '' && trim($this->final2[sizeof($this->final2)-1]) === '') + if (count($this->orig) && count($this->final2) && count($this->orig) === count($this->final2) && trim($this->orig[count($this->orig)-1]) === '' && trim($this->final2[count($this->final2)-1]) === '') { - unset($this->orig[sizeof($this->orig)-1], $this->final2[sizeof($this->final2)-1]); + unset($this->orig[count($this->orig)-1], $this->final2[count($this->final2)-1]); $this->orig = array_values($this->orig); $this->final2 = array_values($this->final2); @@ -972,7 +972,7 @@ class diff3_op } // CASE TWO: Added lines from orig to final2 but final1 had added lines too. Just merge them. - if (!sizeof($this->orig) && $this->final1 !== $this->final2 && sizeof($this->final1) && sizeof($this->final2)) + if (!count($this->orig) && $this->final1 !== $this->final2 && count($this->final1) && count($this->final2)) { $result = $this->_compare_conflict_seq('final2', 'final1'); @@ -1001,7 +1001,7 @@ class diff3_op } // CASE THREE: Removed lines (orig has the to-remove line(s), but final1 has additional lines which does not need to be removed). Just remove orig from final1 and then use final1 as final2/merge - if (!sizeof($this->final2) && sizeof($this->orig) && sizeof($this->final1) && $this->orig !== $this->final1) + if (!count($this->final2) && count($this->orig) && count($this->final1) && $this->orig !== $this->final1) { $result = $this->_compare_conflict_seq('orig', 'final1'); @@ -1011,11 +1011,11 @@ class diff3_op } // First of all, try to find the code in orig in final1. ;) - $compare_seq = sizeof($this->orig); + $compare_seq = count($this->orig); $begin = $end = -1; $j = 0; - for ($i = 0, $size = sizeof($this->final1); $i < $size; $i++) + for ($i = 0, $size = count($this->final1); $i < $size; $i++) { $line = $this->final1[$i]; @@ -1147,6 +1147,6 @@ class diff3_block_builder function _append(&$array, $lines) { - array_splice($array, sizeof($array), 0, $lines); + array_splice($array, count($array), 0, $lines); } } diff --git a/phpBB/includes/diff/engine.php b/phpBB/includes/diff/engine.php index bc21b3b9ba..757fdadde9 100644 --- a/phpBB/includes/diff/engine.php +++ b/phpBB/includes/diff/engine.php @@ -84,8 +84,8 @@ class diff_engine $to_lines = explode("\n", preg_replace('#[\n\r]+#', "\n", $to_lines)); } - $n_from = sizeof($from_lines); - $n_to = sizeof($to_lines); + $n_from = count($from_lines); + $n_to = count($to_lines); $this->xchanged = $this->ychanged = $this->xv = $this->yv = $this->xind = $this->yind = array(); unset($this->seq, $this->in_seq, $this->lcs); @@ -145,7 +145,7 @@ class diff_engine } // Find the LCS. - $this->_compareseq(0, sizeof($this->xv), 0, sizeof($this->yv)); + $this->_compareseq(0, count($this->xv), 0, count($this->yv)); // Merge edits when possible. if ($this->skip_whitespace_changes) @@ -444,8 +444,8 @@ class diff_engine $i = 0; $j = 0; - $len = sizeof($lines); - $other_len = sizeof($other_changed); + $len = count($lines); + $other_len = count($other_changed); while (1) { diff --git a/phpBB/includes/diff/renderer.php b/phpBB/includes/diff/renderer.php index 6b7f07cf9c..c12ff3b7d5 100644 --- a/phpBB/includes/diff/renderer.php +++ b/phpBB/includes/diff/renderer.php @@ -128,8 +128,8 @@ class diff_renderer if (is_array($block)) { // How many lines to keep as context from the copy block. - $keep = ($i == sizeof($diffs) - 1) ? $ntrail : $nlead + $ntrail; - if (sizeof($edit->orig) <= $keep) + $keep = ($i == count($diffs) - 1) ? $ntrail : $nlead + $ntrail; + if (count($edit->orig) <= $keep) { // We have less lines in the block than we want for context => keep the whole block. $block[] = $edit; @@ -156,9 +156,9 @@ class diff_renderer if (!is_array($block)) { // Extract context lines from the preceding copy block. - $context = array_slice($context, sizeof($context) - $nlead); - $x0 = $xi - sizeof($context); - $y0 = $yi - sizeof($context); + $context = array_slice($context, count($context) - $nlead); + $x0 = $xi - count($context); + $y0 = $yi - count($context); $block = array(); if ($context) @@ -169,8 +169,8 @@ class diff_renderer $block[] = $edit; } - $xi += ($edit->orig) ? sizeof($edit->orig) : 0; - $yi += ($edit->final) ? sizeof($edit->final) : 0; + $xi += ($edit->orig) ? count($edit->orig) : 0; + $yi += ($edit->final) ? count($edit->final) : 0; } if (is_array($block)) @@ -433,7 +433,7 @@ class diff_renderer_inline extends diff_renderer { array_walk($lines, array(&$this, '_encode')); $lines[0] = $this->_ins_prefix . $lines[0]; - $lines[sizeof($lines) - 1] .= $this->_ins_suffix; + $lines[count($lines) - 1] .= $this->_ins_suffix; return $this->_lines($lines, ' ', false); } @@ -441,7 +441,7 @@ class diff_renderer_inline extends diff_renderer { array_walk($lines, array(&$this, '_encode')); $lines[0] = $this->_del_prefix . $lines[0]; - $lines[sizeof($lines) - 1] .= $this->_del_suffix; + $lines[count($lines) - 1] .= $this->_del_suffix; return $this->_lines($lines, ' ', false); } @@ -617,7 +617,7 @@ class diff_renderer_side_by_side extends diff_renderer $this->render($diff); // Is the diff empty? - if (!sizeof($this->lines)) + if (!count($this->lines)) { $output .= '
' . $user->lang['NO_VISIBLE_CHANGES'] . '