From 19b12bf6ee54bbfacb5b57a65ae124707e2accab Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 1 Dec 2020 13:10:45 +0700 Subject: [PATCH] [ticket/16649] Upgrade to Symfony 5 PHPBB3-16649 --- phpBB/common.php | 2 +- phpBB/config/default/container/services.yml | 2 + .../default/container/services_attachment.yml | 2 + .../default/container/services_auth.yml | 2 + .../default/container/services_avatar.yml | 2 + .../default/container/services_captcha.yml | 2 + .../default/container/services_console.yml | 2 + .../default/container/services_content.yml | 2 + .../default/container/services_cron.yml | 2 + .../config/default/container/services_db.yml | 2 + .../default/container/services_event.yml | 2 + .../default/container/services_extensions.yml | 2 + .../default/container/services_feed.yml | 2 + .../default/container/services_files.yml | 2 + .../default/container/services_filesystem.yml | 2 + .../default/container/services_help.yml | 2 + .../default/container/services_http.yml | 2 + .../default/container/services_language.yml | 2 + .../default/container/services_migrator.yml | 2 + .../container/services_mimetype_guesser.yml | 6 +- .../default/container/services_module.yml | 2 + .../container/services_notification.yml | 2 + .../default/container/services_password.yml | 2 + .../config/default/container/services_php.yml | 2 + .../container/services_profilefield.yml | 2 + .../default/container/services_report.yml | 2 + .../default/container/services_routing.yml | 2 + .../default/container/services_storage.yml | 1 + .../container/services_text_formatter.yml | 2 + .../container/services_text_reparser.yml | 2 + .../default/container/services_twig.yml | 2 + .../container/services_twig_extensions.yml | 2 + .../config/default/container/services_ucp.yml | 2 + .../default/container/services_user.yml | 2 + phpBB/config/installer/container/services.yml | 2 + .../container/services_file_updater.yml | 2 + .../container/services_install_console.yml | 2 + .../container/services_install_controller.yml | 2 + .../container/services_install_database.yml | 2 + .../container/services_install_filesystem.yml | 2 + .../container/services_install_finish.yml | 2 + .../container/services_install_navigation.yml | 2 + .../services_install_obtain_data.yml | 2 + .../services_install_requirements.yml | 2 + .../container/services_installer.yml | 2 + .../container/services_update_database.yml | 2 + .../container/services_update_filesystem.yml | 2 + .../container/services_update_obtain_data.yml | 2 + .../services_update_requirements.yml | 2 + phpBB/includes/acp/acp_main.php | 2 +- phpBB/includes/acp/acp_storage.php | 2 +- phpBB/includes/functions.php | 2 +- phpBB/includes/functions_display.php | 2 +- phpBB/includes/ucp/ucp_main.php | 2 +- phpBB/phpbb/console/command/cache/purge.php | 5 +- phpBB/phpbb/console/command/config/delete.php | 28 +++++---- phpBB/phpbb/console/command/config/get.php | 6 +- .../console/command/config/increment.php | 5 +- phpBB/phpbb/console/command/config/set.php | 5 +- .../console/command/config/set_atomic.php | 5 +- .../phpbb/console/command/cron/cron_list.php | 7 ++- .../phpbb/console/command/db/list_command.php | 16 +++++ phpBB/phpbb/console/command/db/migrate.php | 17 ++++- phpBB/phpbb/console/command/db/revert.php | 21 ++++++- .../console/command/dev/migration_tips.php | 16 +++++ .../console/command/extension/disable.php | 18 +++++- .../console/command/extension/enable.php | 24 +++++-- .../console/command/extension/install.php | 5 +- .../command/extension/list_available.php | 3 +- .../console/command/extension/manage.php | 7 ++- .../phpbb/console/command/extension/purge.php | 18 +++++- .../console/command/extension/remove.php | 5 +- .../phpbb/console/command/extension/show.php | 16 +++++ .../console/command/extension/update.php | 5 +- .../command/fixup/fix_left_right_ids.php | 4 +- .../console/command/fixup/update_hashes.php | 2 + .../console/command/reparser/list_all.php | 3 +- .../console/command/reparser/reparse.php | 3 +- .../console/command/thumbnail/delete.php | 7 ++- .../console/command/thumbnail/generate.php | 5 +- .../console/command/thumbnail/recreate.php | 3 +- phpBB/phpbb/console/command/update/check.php | 13 ++-- phpBB/phpbb/console/command/user/activate.php | 9 +-- phpBB/phpbb/console/command/user/add.php | 7 ++- phpBB/phpbb/console/command/user/delete.php | 5 +- phpBB/phpbb/console/command/user/reclean.php | 3 +- .../phpbb/cron/event/cron_runner_listener.php | 6 +- .../di/extension/container_configuration.php | 4 +- phpBB/phpbb/event/data.php | 2 +- phpBB/phpbb/event/dispatcher.php | 15 ++--- .../event/kernel_exception_subscriber.php | 8 +-- .../event/kernel_terminate_subscriber.php | 6 +- phpBB/phpbb/event/php_exporter.php | 16 +++-- phpBB/phpbb/filesystem/helper.php | 12 ++++ .../install/helper/container_factory.php | 2 +- phpBB/phpbb/mimetype/guesser.php | 7 ++- phpBB/phpbb/routing/router.php | 36 ++++------- phpBB/phpbb/session.php | 2 +- .../phpbb/template/twig/extension/avatar.php | 4 +- .../phpbb/template/twig/extension/config.php | 4 +- phpBB/phpbb/template/twig/extension/icon.php | 3 +- .../phpbb/template/twig/extension/routing.php | 62 ++++++++++++++++++- .../template/twig/extension/username.php | 4 +- phpBB/phpbb/user.php | 2 +- tests/attachment/upload_test.php | 4 +- tests/console/cache/purge_test.php | 5 +- tests/console/thumbnail_test.php | 3 +- tests/console/user/add_test.php | 2 +- tests/console/user/base.php | 9 --- tests/controller/config/services.yml | 1 + .../ext/vendor2/bar/config/services.yml | 1 + .../ext/vendor2/foo/config/services.yml | 1 + tests/di/create_container_test.php | 8 +-- .../production/container/environment.yml | 1 + .../config/test/container/environment.yml | 1 + .../production/container/environment.yml | 1 + .../test/container/environment.yml | 1 + tests/event/exception_listener_test.php | 2 +- .../controllers_compatibility_test.php | 2 +- .../functional/extension_controller_test.php | 2 +- tests/functional/feed_test.php | 18 +++--- .../fixtures/ext/foo/bar/config/services.yml | 1 + .../fixtures/ext/foo/foo/config/services.yml | 1 + tests/functional/posting_test.php | 4 +- tests/functional/private_messages_test.php | 6 +- tests/mimetype/guesser_test.php | 16 +++-- tests/mock/container_builder.php | 2 +- .../fixtures/services_notification.yml | 1 + .../phpbb_functional_test_case.php | 6 +- .../phpbb_test_case_helpers.php | 2 +- tests/upload/filespec_test.php | 4 +- tests/upload/fileupload_test.php | 4 +- travis/setup-phpbb.sh | 3 +- 133 files changed, 524 insertions(+), 190 deletions(-) diff --git a/phpBB/common.php b/phpBB/common.php index af2a344de6..5627ccd976 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -156,4 +156,4 @@ if (@is_file($phpbb_root_path . $config['exts_composer_vendor_dir'] . '/autoload * @event core.common * @since 3.1.0-a1 */ -$phpbb_dispatcher->dispatch('core.common'); +$phpbb_dispatcher->trigger_event('core.common'); diff --git a/phpBB/config/default/container/services.yml b/phpBB/config/default/container/services.yml index b34e5306e3..a977ff3f8b 100644 --- a/phpBB/config/default/container/services.yml +++ b/phpBB/config/default/container/services.yml @@ -36,6 +36,8 @@ imports: - { resource: parameters.yml } services: + _defaults: { public: true } + cache: class: phpbb\cache\service arguments: diff --git a/phpBB/config/default/container/services_attachment.yml b/phpBB/config/default/container/services_attachment.yml index c54b847685..8a3587113c 100644 --- a/phpBB/config/default/container/services_attachment.yml +++ b/phpBB/config/default/container/services_attachment.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + attachment.delete: class: phpbb\attachment\delete shared: false diff --git a/phpBB/config/default/container/services_auth.yml b/phpBB/config/default/container/services_auth.yml index 6c9d224ad2..cc415fb569 100644 --- a/phpBB/config/default/container/services_auth.yml +++ b/phpBB/config/default/container/services_auth.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + # ----- Auth management ----- auth: class: phpbb\auth\auth diff --git a/phpBB/config/default/container/services_avatar.yml b/phpBB/config/default/container/services_avatar.yml index 1cbc44115d..ae6179698a 100644 --- a/phpBB/config/default/container/services_avatar.yml +++ b/phpBB/config/default/container/services_avatar.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + avatar.manager: class: phpbb\avatar\manager arguments: diff --git a/phpBB/config/default/container/services_captcha.yml b/phpBB/config/default/container/services_captcha.yml index ba10264093..af9bbec2de 100644 --- a/phpBB/config/default/container/services_captcha.yml +++ b/phpBB/config/default/container/services_captcha.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + captcha.factory: class: phpbb\captcha\factory arguments: diff --git a/phpBB/config/default/container/services_console.yml b/phpBB/config/default/container/services_console.yml index 74cfade99d..d44ca3590b 100644 --- a/phpBB/config/default/container/services_console.yml +++ b/phpBB/config/default/container/services_console.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + console.exception_subscriber: class: phpbb\console\exception_subscriber arguments: diff --git a/phpBB/config/default/container/services_content.yml b/phpBB/config/default/container/services_content.yml index 3cdd0cfe6f..b97496b437 100644 --- a/phpBB/config/default/container/services_content.yml +++ b/phpBB/config/default/container/services_content.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + content.visibility: class: phpbb\content_visibility arguments: diff --git a/phpBB/config/default/container/services_cron.yml b/phpBB/config/default/container/services_cron.yml index 70affbbaf4..aef6ccd75d 100644 --- a/phpBB/config/default/container/services_cron.yml +++ b/phpBB/config/default/container/services_cron.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + cron.manager: class: phpbb\cron\manager arguments: diff --git a/phpBB/config/default/container/services_db.yml b/phpBB/config/default/container/services_db.yml index fe7d42937d..22afeac6b1 100644 --- a/phpBB/config/default/container/services_db.yml +++ b/phpBB/config/default/container/services_db.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + dbal.conn: class: phpbb\db\driver\factory arguments: diff --git a/phpBB/config/default/container/services_event.yml b/phpBB/config/default/container/services_event.yml index 5696275e64..ef64821993 100644 --- a/phpBB/config/default/container/services_event.yml +++ b/phpBB/config/default/container/services_event.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + dispatcher: class: phpbb\event\dispatcher arguments: diff --git a/phpBB/config/default/container/services_extensions.yml b/phpBB/config/default/container/services_extensions.yml index 53e36f0fda..9e890f761c 100644 --- a/phpBB/config/default/container/services_extensions.yml +++ b/phpBB/config/default/container/services_extensions.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + ext.manager: class: phpbb\extension\manager arguments: diff --git a/phpBB/config/default/container/services_feed.yml b/phpBB/config/default/container/services_feed.yml index f32d0cb4d3..08f5adf919 100644 --- a/phpBB/config/default/container/services_feed.yml +++ b/phpBB/config/default/container/services_feed.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + phpbb.feed.controller: class: phpbb\feed\controller\feed arguments: diff --git a/phpBB/config/default/container/services_files.yml b/phpBB/config/default/container/services_files.yml index b6cb2f6a45..20ee9457e1 100644 --- a/phpBB/config/default/container/services_files.yml +++ b/phpBB/config/default/container/services_files.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + files.factory: class: phpbb\files\factory arguments: diff --git a/phpBB/config/default/container/services_filesystem.yml b/phpBB/config/default/container/services_filesystem.yml index 15206314b9..342f2a33c2 100644 --- a/phpBB/config/default/container/services_filesystem.yml +++ b/phpBB/config/default/container/services_filesystem.yml @@ -2,6 +2,8 @@ parameters: core.filesystem.cache_temp_dir: '%core.cache_dir%tmp/' services: + _defaults: { public: true } + filesystem: class: phpbb\filesystem\filesystem diff --git a/phpBB/config/default/container/services_help.yml b/phpBB/config/default/container/services_help.yml index 1bff001523..0574720099 100644 --- a/phpBB/config/default/container/services_help.yml +++ b/phpBB/config/default/container/services_help.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + phpbb.help.manager: class: phpbb\help\manager arguments: diff --git a/phpBB/config/default/container/services_http.yml b/phpBB/config/default/container/services_http.yml index 49cfbf5b84..20710a5d01 100644 --- a/phpBB/config/default/container/services_http.yml +++ b/phpBB/config/default/container/services_http.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + http_kernel: class: Symfony\Component\HttpKernel\HttpKernel arguments: diff --git a/phpBB/config/default/container/services_language.yml b/phpBB/config/default/container/services_language.yml index 8201fbf9b6..fe5764214f 100644 --- a/phpBB/config/default/container/services_language.yml +++ b/phpBB/config/default/container/services_language.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + language.helper.language_file: class: phpbb\language\language_file_helper arguments: diff --git a/phpBB/config/default/container/services_migrator.yml b/phpBB/config/default/container/services_migrator.yml index ce478050ea..37728ef6f3 100644 --- a/phpBB/config/default/container/services_migrator.yml +++ b/phpBB/config/default/container/services_migrator.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + # ----- Migrator ----- migrator: class: phpbb\db\migrator diff --git a/phpBB/config/default/container/services_mimetype_guesser.yml b/phpBB/config/default/container/services_mimetype_guesser.yml index 432470d40c..61421a555f 100644 --- a/phpBB/config/default/container/services_mimetype_guesser.yml +++ b/phpBB/config/default/container/services_mimetype_guesser.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + mimetype.guesser_collection: class: phpbb\di\service_collection arguments: @@ -7,12 +9,12 @@ services: - { name: service_collection, tag: mimetype.guessers } mimetype.fileinfo_mimetype_guesser: - class: Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser + class: Symfony\Component\Mime\FileinfoMimeTypeGuesser tags: - { name: mimetype.guessers } mimetype.filebinary_mimetype_guesser: - class: Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser + class: Symfony\Component\Mime\FileBinaryMimeTypeGuesser tags: - { name: mimetype.guessers } diff --git a/phpBB/config/default/container/services_module.yml b/phpBB/config/default/container/services_module.yml index a057e55239..67453083c5 100644 --- a/phpBB/config/default/container/services_module.yml +++ b/phpBB/config/default/container/services_module.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + module.manager: class: phpbb\module\module_manager arguments: diff --git a/phpBB/config/default/container/services_notification.yml b/phpBB/config/default/container/services_notification.yml index c18e358114..20be74b82c 100644 --- a/phpBB/config/default/container/services_notification.yml +++ b/phpBB/config/default/container/services_notification.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + notification_manager: class: phpbb\notification\manager arguments: diff --git a/phpBB/config/default/container/services_password.yml b/phpBB/config/default/container/services_password.yml index 38f7404330..e1822d629c 100644 --- a/phpBB/config/default/container/services_password.yml +++ b/phpBB/config/default/container/services_password.yml @@ -5,6 +5,8 @@ parameters: passwords.driver.bcrypt_cost: 10 services: + _defaults: { public: true } + # ----- Password management ----- passwords.manager: class: phpbb\passwords\manager diff --git a/phpBB/config/default/container/services_php.yml b/phpBB/config/default/container/services_php.yml index 29349960f3..bf6992159a 100644 --- a/phpBB/config/default/container/services_php.yml +++ b/phpBB/config/default/container/services_php.yml @@ -1,3 +1,5 @@ services: + _defaults: { public: true } + php_ini: class: bantu\IniGetWrapper\IniGetWrapper diff --git a/phpBB/config/default/container/services_profilefield.yml b/phpBB/config/default/container/services_profilefield.yml index aca8b65db6..c326e66d2f 100644 --- a/phpBB/config/default/container/services_profilefield.yml +++ b/phpBB/config/default/container/services_profilefield.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + profilefields.manager: class: phpbb\profilefields\manager arguments: diff --git a/phpBB/config/default/container/services_report.yml b/phpBB/config/default/container/services_report.yml index 2c5b3bf3d5..076858678c 100644 --- a/phpBB/config/default/container/services_report.yml +++ b/phpBB/config/default/container/services_report.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + # ----- Report controller ----- phpbb.report.controller: class: phpbb\report\controller\report diff --git a/phpBB/config/default/container/services_routing.yml b/phpBB/config/default/container/services_routing.yml index 5b7fc35b5a..8734647749 100644 --- a/phpBB/config/default/container/services_routing.yml +++ b/phpBB/config/default/container/services_routing.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + router: class: phpbb\routing\router arguments: diff --git a/phpBB/config/default/container/services_storage.yml b/phpBB/config/default/container/services_storage.yml index 92f31779e6..fce8198e82 100644 --- a/phpBB/config/default/container/services_storage.yml +++ b/phpBB/config/default/container/services_storage.yml @@ -1,4 +1,5 @@ services: + _defaults: { public: true } # Storages storage.attachment: diff --git a/phpBB/config/default/container/services_text_formatter.yml b/phpBB/config/default/container/services_text_formatter.yml index 4e4abf6564..276c48a5b5 100644 --- a/phpBB/config/default/container/services_text_formatter.yml +++ b/phpBB/config/default/container/services_text_formatter.yml @@ -4,6 +4,8 @@ parameters: text_formatter.cache.renderer.key: _text_formatter_renderer services: + _defaults: { public: true } + text_formatter.acp_utils: class: phpbb\textformatter\s9e\acp_utils arguments: diff --git a/phpBB/config/default/container/services_text_reparser.yml b/phpBB/config/default/container/services_text_reparser.yml index 32377f2bb4..c0c531d509 100644 --- a/phpBB/config/default/container/services_text_reparser.yml +++ b/phpBB/config/default/container/services_text_reparser.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + text_reparser.manager: class: phpbb\textreparser\manager arguments: diff --git a/phpBB/config/default/container/services_twig.yml b/phpBB/config/default/container/services_twig.yml index 747d2ee155..b87c8cbb4e 100644 --- a/phpBB/config/default/container/services_twig.yml +++ b/phpBB/config/default/container/services_twig.yml @@ -2,6 +2,8 @@ parameters: core.template.cache_path: '%core.cache_dir%twig/' services: + _defaults: { public: true } + template.twig.environment: class: phpbb\template\twig\environment arguments: diff --git a/phpBB/config/default/container/services_twig_extensions.yml b/phpBB/config/default/container/services_twig_extensions.yml index 115d3f1417..736d07f7b0 100644 --- a/phpBB/config/default/container/services_twig_extensions.yml +++ b/phpBB/config/default/container/services_twig_extensions.yml @@ -1,6 +1,8 @@ # Twig extensions not needed by the installer services: + _defaults: { public: true } + template.twig.extensions.icon: class: phpbb\template\twig\extension\icon arguments: diff --git a/phpBB/config/default/container/services_ucp.yml b/phpBB/config/default/container/services_ucp.yml index 861fa4ac75..570f1a1de0 100644 --- a/phpBB/config/default/container/services_ucp.yml +++ b/phpBB/config/default/container/services_ucp.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + phpbb.ucp.controller.reset_password: class: phpbb\ucp\controller\reset_password arguments: diff --git a/phpBB/config/default/container/services_user.yml b/phpBB/config/default/container/services_user.yml index 7e634c60c3..b3663a8f35 100644 --- a/phpBB/config/default/container/services_user.yml +++ b/phpBB/config/default/container/services_user.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + acl.permissions: class: phpbb\permissions arguments: diff --git a/phpBB/config/installer/container/services.yml b/phpBB/config/installer/container/services.yml index 080b8a48e3..9d1daa840a 100644 --- a/phpBB/config/installer/container/services.yml +++ b/phpBB/config/installer/container/services.yml @@ -9,6 +9,8 @@ imports: - { resource: ../../default/container/services_twig.yml } services: + _defaults: { public: true } + cache.driver: class: '%cache.driver.class%' arguments: diff --git a/phpBB/config/installer/container/services_file_updater.yml b/phpBB/config/installer/container/services_file_updater.yml index 9d39bb8b89..188f0aea00 100644 --- a/phpBB/config/installer/container/services_file_updater.yml +++ b/phpBB/config/installer/container/services_file_updater.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + installer.file_updater.factory: class: phpbb\install\helper\file_updater\factory arguments: diff --git a/phpBB/config/installer/container/services_install_console.yml b/phpBB/config/installer/container/services_install_console.yml index 41d3aa4c1b..8dd57e9ed4 100644 --- a/phpBB/config/installer/container/services_install_console.yml +++ b/phpBB/config/installer/container/services_install_console.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + console.installer.command_collection: class: phpbb\di\service_collection arguments: diff --git a/phpBB/config/installer/container/services_install_controller.yml b/phpBB/config/installer/container/services_install_controller.yml index 5aaba0f47f..f32786921c 100644 --- a/phpBB/config/installer/container/services_install_controller.yml +++ b/phpBB/config/installer/container/services_install_controller.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + phpbb.installer.controller.welcome: class: phpbb\install\controller\installer_index arguments: diff --git a/phpBB/config/installer/container/services_install_database.yml b/phpBB/config/installer/container/services_install_database.yml index 14baed7e79..6cd9e09183 100644 --- a/phpBB/config/installer/container/services_install_database.yml +++ b/phpBB/config/installer/container/services_install_database.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + installer.install_database.create_schema_file: class: phpbb\install\module\install_database\task\create_schema_file arguments: diff --git a/phpBB/config/installer/container/services_install_filesystem.yml b/phpBB/config/installer/container/services_install_filesystem.yml index 996e593d15..c876d19d5c 100644 --- a/phpBB/config/installer/container/services_install_filesystem.yml +++ b/phpBB/config/installer/container/services_install_filesystem.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + installer.install_filesystem.create_config_file: class: phpbb\install\module\install_filesystem\task\create_config_file arguments: diff --git a/phpBB/config/installer/container/services_install_finish.yml b/phpBB/config/installer/container/services_install_finish.yml index b200118e11..14df61734d 100644 --- a/phpBB/config/installer/container/services_install_finish.yml +++ b/phpBB/config/installer/container/services_install_finish.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + installer.install_finish.populate_migrations: class: phpbb\install\module\install_finish\task\populate_migrations arguments: diff --git a/phpBB/config/installer/container/services_install_navigation.yml b/phpBB/config/installer/container/services_install_navigation.yml index d7151eb1c6..7a5497354e 100644 --- a/phpBB/config/installer/container/services_install_navigation.yml +++ b/phpBB/config/installer/container/services_install_navigation.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + installer.navigation.provider: class: phpbb\install\helper\navigation\navigation_provider arguments: diff --git a/phpBB/config/installer/container/services_install_obtain_data.yml b/phpBB/config/installer/container/services_install_obtain_data.yml index 04b6912853..b97cbb06e9 100644 --- a/phpBB/config/installer/container/services_install_obtain_data.yml +++ b/phpBB/config/installer/container/services_install_obtain_data.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + installer.obtain_data.obtain_admin_data: class: phpbb\install\module\obtain_data\task\obtain_admin_data arguments: diff --git a/phpBB/config/installer/container/services_install_requirements.yml b/phpBB/config/installer/container/services_install_requirements.yml index 93d123a0e9..4c51c0fb1b 100644 --- a/phpBB/config/installer/container/services_install_requirements.yml +++ b/phpBB/config/installer/container/services_install_requirements.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + installer.requirements.check_filesystem: class: phpbb\install\module\requirements\task\check_filesystem arguments: diff --git a/phpBB/config/installer/container/services_installer.yml b/phpBB/config/installer/container/services_installer.yml index 57181b21d4..f699b5fbd5 100644 --- a/phpBB/config/installer/container/services_installer.yml +++ b/phpBB/config/installer/container/services_installer.yml @@ -15,6 +15,8 @@ imports: - { resource: services_update_requirements.yml } services: + _defaults: { public: true } + # -------- Installer helpers ------------------------ installer.helper.config: class: phpbb\install\helper\config diff --git a/phpBB/config/installer/container/services_update_database.yml b/phpBB/config/installer/container/services_update_database.yml index 836b943670..d86c49fe8c 100644 --- a/phpBB/config/installer/container/services_update_database.yml +++ b/phpBB/config/installer/container/services_update_database.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + installer.update_database.update_task: class: phpbb\install\module\update_database\task\update arguments: diff --git a/phpBB/config/installer/container/services_update_filesystem.yml b/phpBB/config/installer/container/services_update_filesystem.yml index 1dce58eaad..6949a6f845 100644 --- a/phpBB/config/installer/container/services_update_filesystem.yml +++ b/phpBB/config/installer/container/services_update_filesystem.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + installer.update_filesystem.check_task: class: phpbb\install\module\update_filesystem\task\file_check arguments: diff --git a/phpBB/config/installer/container/services_update_obtain_data.yml b/phpBB/config/installer/container/services_update_obtain_data.yml index 37eb66ae01..531fca438f 100644 --- a/phpBB/config/installer/container/services_update_obtain_data.yml +++ b/phpBB/config/installer/container/services_update_obtain_data.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + installer.obtain_data.update_options: class: phpbb\install\module\obtain_data\task\obtain_update_settings arguments: diff --git a/phpBB/config/installer/container/services_update_requirements.yml b/phpBB/config/installer/container/services_update_requirements.yml index 7ca7c921d1..656b41cb2a 100644 --- a/phpBB/config/installer/container/services_update_requirements.yml +++ b/phpBB/config/installer/container/services_update_requirements.yml @@ -1,4 +1,6 @@ services: + _defaults: { public: true } + installer.requirements.check_filesystem_update: class: phpbb\install\module\requirements\task\check_filesystem arguments: diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 424850c4bd..fcbb736eb6 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -484,7 +484,7 @@ class acp_main * @event core.acp_main_notice * @since 3.1.0-RC3 */ - $phpbb_dispatcher->dispatch('core.acp_main_notice'); + $phpbb_dispatcher->trigger_event('core.acp_main_notice'); // Get forum statistics $total_posts = $config['num_posts']; diff --git a/phpBB/includes/acp/acp_storage.php b/phpBB/includes/acp/acp_storage.php index 9ba84aafaf..f6dce91ff9 100644 --- a/phpBB/includes/acp/acp_storage.php +++ b/phpBB/includes/acp/acp_storage.php @@ -84,7 +84,7 @@ class acp_storage * @event core.acp_storage_load * @since 3.3.0-a1 */ - $phpbb_dispatcher->dispatch('core.acp_storage_load'); + $phpbb_dispatcher->trigger_event('core.acp_storage_load'); $this->overview($id, $mode); } diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9babde898f..d4c7db9248 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4189,7 +4189,7 @@ function garbage_collection() * @event core.garbage_collection * @since 3.1.0-a1 */ - $phpbb_dispatcher->dispatch('core.garbage_collection'); + $phpbb_dispatcher->trigger_event('core.garbage_collection'); } // Unload cache, must be done before the DB connection if closed diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index b72f71d9b3..db6ae7e6f1 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1152,7 +1152,7 @@ function display_custom_bbcodes() * @event core.display_custom_bbcodes * @since 3.1.0-a1 */ - $phpbb_dispatcher->dispatch('core.display_custom_bbcodes'); + $phpbb_dispatcher->trigger_event('core.display_custom_bbcodes'); } /** diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 9c653fd466..afd0ca9941 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -262,7 +262,7 @@ class ucp_main * @event core.ucp_main_subscribed_post_data * @since 3.1.10-RC1 */ - $phpbb_dispatcher->dispatch('core.ucp_main_subscribed_post_data'); + $phpbb_dispatcher->trigger_event('core.ucp_main_subscribed_post_data'); if ($unwatch) { diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index b7a51b2bb4..338bfe362d 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\cache; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; @@ -72,7 +73,7 @@ class purge extends \phpbb\console\command\command * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * - * @return void + * @return int */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -87,5 +88,7 @@ class purge extends \phpbb\console\command\command $io = new SymfonyStyle($input, $output); $io->success($this->user->lang('PURGE_CACHE_SUCCESS')); + + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 2da0801337..ce73652ef7 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\config; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -20,8 +21,8 @@ use Symfony\Component\Console\Style\SymfonyStyle; class delete extends command { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function configure() { $this @@ -36,16 +37,16 @@ class delete extends command } /** - * Executes the command config:delete. - * - * Removes a configuration option - * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - * - * @return void - * @see \phpbb\config\config::delete() - */ + * Executes the command config:delete. + * + * Removes a configuration option + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return int + * @see \phpbb\config\config::delete() + */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); @@ -57,10 +58,13 @@ class delete extends command $this->config->delete($key); $io->success($this->user->lang('CLI_CONFIG_DELETE_SUCCESS', $key)); + + return symfony_command::SUCCESS; } else { $io->error($this->user->lang('CLI_CONFIG_NOT_EXISTS', $key)); + return symfony_command::FAILURE; } } } diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index f065787110..eea5819da1 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\config; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -50,7 +51,7 @@ class get extends command * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * - * @return void + * @return int * @see \phpbb\config\config::offsetGet() */ protected function execute(InputInterface $input, OutputInterface $output) @@ -62,14 +63,17 @@ class get extends command if (isset($this->config[$key]) && $input->getOption('no-newline')) { $output->write($this->config[$key]); + return symfony_command::SUCCESS; } else if (isset($this->config[$key])) { $output->writeln($this->config[$key]); + return symfony_command::SUCCESS; } else { $io->error($this->user->lang('CLI_CONFIG_NOT_EXISTS', $key)); + return symfony_command::FAILURE; } } } diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 647380a0bf..31078c5ecd 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\config; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -55,7 +56,7 @@ class increment extends command * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * - * @return void + * @return int * @see \phpbb\config\config::increment() */ protected function execute(InputInterface $input, OutputInterface $output) @@ -69,5 +70,7 @@ class increment extends command $this->config->increment($key, $increment, $use_cache); $io->success($this->user->lang('CLI_CONFIG_INCREMENT_SUCCESS', $key)); + + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php index e9f7f8f91e..d7e57697d2 100644 --- a/phpBB/phpbb/console/command/config/set.php +++ b/phpBB/phpbb/console/command/config/set.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\config; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -55,7 +56,7 @@ class set extends command * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * - * @return void + * @return int * @see \phpbb\config\config::set() */ protected function execute(InputInterface $input, OutputInterface $output) @@ -69,5 +70,7 @@ class set extends command $this->config->set($key, $value, $use_cache); $io->success($this->user->lang('CLI_CONFIG_SET_SUCCESS', $key)); + + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index 25752ee063..a2b79c0500 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\config; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -76,12 +77,12 @@ class set_atomic extends command if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache)) { $io->success($this->user->lang('CLI_CONFIG_SET_SUCCESS', $key)); - return 0; + return symfony_command::SUCCESS; } else { $io->error($this->user->lang('CLI_CONFIG_SET_FAILURE', $key)); - return 1; + return symfony_command::FAILURE; } } } diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index ea61e45235..cacc17ff0e 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\cron; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; @@ -52,7 +53,7 @@ class cron_list extends \phpbb\console\command\command * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * - * @return void + * @return int */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -63,7 +64,7 @@ class cron_list extends \phpbb\console\command\command if (empty($tasks)) { $io->error($this->user->lang('CRON_NO_TASKS')); - return; + return symfony_command::FAILURE; } $ready_tasks = $not_ready_tasks = array(); @@ -90,5 +91,7 @@ class cron_list extends \phpbb\console\command\command $io->title($this->user->lang('TASKS_NOT_READY')); $io->listing($not_ready_tasks); } + + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/db/list_command.php b/phpBB/phpbb/console/command/db/list_command.php index 77f26dd786..edc9222009 100644 --- a/phpBB/phpbb/console/command/db/list_command.php +++ b/phpBB/phpbb/console/command/db/list_command.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\db; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -19,6 +20,9 @@ use Symfony\Component\Console\Style\SymfonyStyle; class list_command extends \phpbb\console\command\db\migration_command { + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -33,6 +37,16 @@ class list_command extends \phpbb\console\command\db\migration_command ; } + /** + * Executes the command db:list. + * + * Lists all installed and available migrations + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return int + */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); @@ -71,11 +85,13 @@ class list_command extends \phpbb\console\command\db\migration_command if (!empty($available)) { $io->listing($available); + return symfony_command::SUCCESS; } else { $io->text($this->user->lang('CLI_MIGRATIONS_EMPTY')); $io->newLine(); + return symfony_command::FAILURE; } } } diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 4270e2d703..e60fb83887 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\db; +use Symfony\Component\Console\Command\Command as symfony_command; use phpbb\db\output_handler\log_wrapper_migrator_output_handler; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -41,6 +42,9 @@ class migrate extends \phpbb\console\command\db\migration_command $this->language->add_lang(array('common', 'install', 'migrator')); } + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -49,6 +53,16 @@ class migrate extends \phpbb\console\command\db\migration_command ; } + /** + * Executes the command db:migrate. + * + * Updates the database by applying migrations + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return int + */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); @@ -71,7 +85,7 @@ class migrate extends \phpbb\console\command\db\migration_command { $io->error($e->getLocalisedMessage($this->user)); $this->finalise_update(); - return 1; + return symfony_command::FAILURE; } } @@ -82,5 +96,6 @@ class migrate extends \phpbb\console\command\db\migration_command $this->finalise_update(); $io->success($this->language->lang('INLINE_UPDATE_SUCCESSFUL')); + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/db/revert.php b/phpBB/phpbb/console/command/db/revert.php index 3c79d8c554..7814f00f94 100644 --- a/phpBB/phpbb/console/command/db/revert.php +++ b/phpBB/phpbb/console/command/db/revert.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\db; +use Symfony\Component\Console\Command\Command as symfony_command; use phpbb\db\output_handler\log_wrapper_migrator_output_handler; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -20,6 +21,9 @@ use Symfony\Component\Console\Style\SymfonyStyle; class revert extends \phpbb\console\command\db\migrate { + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -33,6 +37,16 @@ class revert extends \phpbb\console\command\db\migrate ; } + /** + * Executes the command db:revert. + * + * Reverts a migration + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return int + */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); @@ -46,12 +60,12 @@ class revert extends \phpbb\console\command\db\migrate if (!in_array($name, $this->load_migrations())) { $io->error($this->language->lang('MIGRATION_NOT_VALID', $name)); - return 1; + return symfony_command::FAILURE; } else if ($this->migrator->migration_state($name) === false) { $io->error($this->language->lang('MIGRATION_NOT_INSTALLED', $name)); - return 1; + return symfony_command::FAILURE; } try @@ -65,10 +79,11 @@ class revert extends \phpbb\console\command\db\migrate { $io->error($e->getLocalisedMessage($this->user)); $this->finalise_update(); - return 1; + return symfony_command::FAILURE; } $this->finalise_update(); $io->success($this->language->lang('INLINE_UPDATE_SUCCESSFUL')); + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php index 99aa27915a..885103118f 100644 --- a/phpBB/phpbb/console/command/dev/migration_tips.php +++ b/phpBB/phpbb/console/command/dev/migration_tips.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\dev; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -26,6 +27,9 @@ class migration_tips extends \phpbb\console\command\command parent::__construct($user); } + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -34,6 +38,16 @@ class migration_tips extends \phpbb\console\command\command ; } + /** + * Executes the command dev:migration-tips. + * + * Finds migrations that are not depended upon + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return int + */ protected function execute(InputInterface $input, OutputInterface $output) { $migrations = $this->extension_manager->get_finder() @@ -60,5 +74,7 @@ class migration_tips extends \phpbb\console\command\command $output->writeln("\t\t\t'{$migration}',"); } $output->writeln("\t\t];"); + + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index 4d51bd7be5..9113ef0f33 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\extension; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -19,6 +20,9 @@ use Symfony\Component\Console\Style\SymfonyStyle; class disable extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -32,6 +36,16 @@ class disable extends command ; } + /** + * Executes the command extension:disable. + * + * Disables the specified extension + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return int + */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); @@ -50,14 +64,14 @@ class disable extends command if ($this->manager->is_enabled($name)) { $io->error($this->user->lang('CLI_EXTENSION_DISABLE_FAILURE', $name)); - return 1; + return symfony_command::FAILURE; } else { $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_DISABLE', time(), array($name)); $this->check_apcu_cache($io); $io->success($this->user->lang('CLI_EXTENSION_DISABLE_SUCCESS', $name)); - return 0; + return symfony_command::SUCCESS; } } } diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index 00decc8607..a83d4cf4af 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\extension; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -19,6 +20,9 @@ use Symfony\Component\Console\Style\SymfonyStyle; class enable extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -32,6 +36,16 @@ class enable extends command ; } + /** + * Executes the command extension:enable. + * + * Enables the specified extension + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return int + */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); @@ -41,7 +55,7 @@ class enable extends command if (!$this->manager->is_available($name)) { $io->error($this->user->lang('CLI_EXTENSION_NOT_EXIST', $name)); - return 1; + return symfony_command::FAILURE; } $extension = $this->manager->get_extension($name); @@ -51,13 +65,13 @@ class enable extends command $message = !empty($enableable) ? $enableable : $this->user->lang('CLI_EXTENSION_NOT_ENABLEABLE', $name); $message = is_array($message) ? implode(PHP_EOL, $message) : $message; $io->error($message); - return 1; + return symfony_command::FAILURE; } if ($this->manager->is_enabled($name)) { $io->error($this->user->lang('CLI_EXTENSION_ENABLED', $name)); - return 1; + return symfony_command::FAILURE; } $this->manager->enable($name); @@ -68,12 +82,12 @@ class enable extends command $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name)); $this->check_apcu_cache($io); $io->success($this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name)); - return 0; + return symfony_command::SUCCESS; } else { $io->error($this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name)); - return 1; + return symfony_command::FAILURE; } } } diff --git a/phpBB/phpbb/console/command/extension/install.php b/phpBB/phpbb/console/command/extension/install.php index 8b11f9b5c8..7de0805754 100644 --- a/phpBB/phpbb/console/command/extension/install.php +++ b/phpBB/phpbb/console/command/extension/install.php @@ -16,6 +16,7 @@ namespace phpbb\console\command\extension; use phpbb\composer\extension_manager; use phpbb\composer\io\console_io; use phpbb\language\language; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -83,7 +84,7 @@ class install extends \phpbb\console\command\command if (!$this->manager->check_requirements()) { $io->error($this->language->lang('EXTENSIONS_COMPOSER_NOT_WRITABLE')); - return 1; + return symfony_command::FAILURE; } $composer_io = new console_io($input, $output, $this->getHelperSet(), $this->language); @@ -98,6 +99,6 @@ class install extends \phpbb\console\command\command $io->success($this->language->lang('EXTENSIONS_INSTALLED')); - return 0; + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/extension/list_available.php b/phpBB/phpbb/console/command/extension/list_available.php index 7f9efe6771..40f58c372d 100644 --- a/phpBB/phpbb/console/command/extension/list_available.php +++ b/phpBB/phpbb/console/command/extension/list_available.php @@ -14,6 +14,7 @@ namespace phpbb\console\command\extension; use phpbb\composer\manager_interface; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; @@ -68,6 +69,6 @@ class list_available extends \phpbb\console\command\command $io->listing($extensions); - return 0; + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/extension/manage.php b/phpBB/phpbb/console/command/extension/manage.php index fcd30cc707..a287557b04 100644 --- a/phpBB/phpbb/console/command/extension/manage.php +++ b/phpBB/phpbb/console/command/extension/manage.php @@ -17,6 +17,7 @@ use phpbb\composer\exception\managed_with_error_exception; use phpbb\composer\io\console_io; use phpbb\composer\manager_interface; use phpbb\language\language; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -75,7 +76,7 @@ class manage extends \phpbb\console\command\command if (!$this->manager->check_requirements()) { $io->error($this->language->lang('EXTENSIONS_COMPOSER_NOT_WRITABLE')); - return 1; + return symfony_command::FAILURE; } $composer_io = new console_io($input, $output, $this->getHelperSet(), $this->language); @@ -89,11 +90,11 @@ class manage extends \phpbb\console\command\command catch (managed_with_error_exception $e) { $io->warning($this->language->lang_array($e->getMessage(), $e->get_parameters())); - return 1; + return symfony_command::FAILURE; } $io->success($this->language->lang('EXTENSION_MANAGED_SUCCESS', $extension)); - return 0; + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php index 9aa925e9f6..0ac47fb0a3 100644 --- a/phpBB/phpbb/console/command/extension/purge.php +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\extension; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -19,6 +20,9 @@ use Symfony\Component\Console\Style\SymfonyStyle; class purge extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -32,6 +36,16 @@ class purge extends command ; } + /** + * Executes the command extension:purge. + * + * Purges the specified extension + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return int + */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); @@ -43,14 +57,14 @@ class purge extends command if ($this->manager->is_enabled($name)) { $io->error($this->user->lang('CLI_EXTENSION_PURGE_FAILURE', $name)); - return 1; + return symfony_command::FAILURE; } else { $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name)); $this->check_apcu_cache($io); $io->success($this->user->lang('CLI_EXTENSION_PURGE_SUCCESS', $name)); - return 0; + return symfony_command::SUCCESS; } } } diff --git a/phpBB/phpbb/console/command/extension/remove.php b/phpBB/phpbb/console/command/extension/remove.php index d2f09657d5..629d55a7a9 100644 --- a/phpBB/phpbb/console/command/extension/remove.php +++ b/phpBB/phpbb/console/command/extension/remove.php @@ -16,6 +16,7 @@ namespace phpbb\console\command\extension; use phpbb\composer\extension_manager; use phpbb\composer\io\console_io; use phpbb\language\language; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -83,7 +84,7 @@ class remove extends \phpbb\console\command\command if (!$this->manager->check_requirements()) { $io->error($this->language->lang('EXTENSIONS_COMPOSER_NOT_WRITABLE')); - return 1; + return symfony_command::FAILURE; } $composer_io = new console_io($input, $output, $this->getHelperSet(), $this->language); @@ -98,6 +99,6 @@ class remove extends \phpbb\console\command\command $io->success($this->language->lang('EXTENSIONS_REMOVED')); - return 0; + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php index 7bad0c0a5a..2986a3d96c 100644 --- a/phpBB/phpbb/console/command/extension/show.php +++ b/phpBB/phpbb/console/command/extension/show.php @@ -12,12 +12,16 @@ */ namespace phpbb\console\command\extension; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; class show extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -26,6 +30,16 @@ class show extends command ; } + /** + * Executes the command extension:show. + * + * Lists all extensions in the database and on the filesystem + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return int + */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); @@ -50,5 +64,7 @@ class show extends command $purged = array_diff($all, $enabled, $disabled); $io->section($this->user->lang('CLI_EXTENSIONS_AVAILABLE')); $io->listing($purged); + + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/extension/update.php b/phpBB/phpbb/console/command/extension/update.php index a8236e5366..8992b48241 100644 --- a/phpBB/phpbb/console/command/extension/update.php +++ b/phpBB/phpbb/console/command/extension/update.php @@ -16,6 +16,7 @@ namespace phpbb\console\command\extension; use phpbb\composer\io\console_io; use phpbb\composer\manager_interface; use phpbb\language\language; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -75,7 +76,7 @@ class update extends \phpbb\console\command\command if (!$this->manager->check_requirements()) { $io->error($this->language->lang('EXTENSIONS_COMPOSER_NOT_WRITABLE')); - return 1; + return symfony_command::FAILURE; } $composer_io = new console_io($input, $output, $this->getHelperSet(), $this->language); @@ -85,6 +86,6 @@ class update extends \phpbb\console\command\command $io->success($this->language->lang('EXTENSIONS_UPDATED')); - return 0; + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php b/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php index 271b099a6c..778c7fe8e7 100644 --- a/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php +++ b/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php @@ -13,6 +13,7 @@ namespace phpbb\console\command\fixup; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; @@ -64,7 +65,7 @@ class fix_left_right_ids extends \phpbb\console\command\command * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * - * @return void + * @return int */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -87,6 +88,7 @@ class fix_left_right_ids extends \phpbb\console\command\command $this->cache->purge(); $io->success($this->user->lang('CLI_FIXUP_FIX_LEFT_RIGHT_IDS_SUCCESS')); + return symfony_command::SUCCESS; } /** diff --git a/phpBB/phpbb/console/command/fixup/update_hashes.php b/phpBB/phpbb/console/command/fixup/update_hashes.php index 8a2ef60771..d12d0e755d 100644 --- a/phpBB/phpbb/console/command/fixup/update_hashes.php +++ b/phpBB/phpbb/console/command/fixup/update_hashes.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\fixup; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Helper\ProgressBar; @@ -114,5 +115,6 @@ class update_hashes extends \phpbb\console\command\command $progress_bar->finish(); $output->writeln('' . $this->user->lang('CLI_FIXUP_UPDATE_HASH_BCRYPT_SUCCESS') . ''); + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/reparser/list_all.php b/phpBB/phpbb/console/command/reparser/list_all.php index a79578abf0..16b7f50519 100644 --- a/phpBB/phpbb/console/command/reparser/list_all.php +++ b/phpBB/phpbb/console/command/reparser/list_all.php @@ -13,6 +13,7 @@ namespace phpbb\console\command\reparser; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; @@ -67,6 +68,6 @@ class list_all extends \phpbb\console\command\command $io->section($this->user->lang('CLI_DESCRIPTION_REPARSER_AVAILABLE')); $io->listing($this->reparser_names); - return 0; + return symfony_command::SUCCESS; } } diff --git a/phpBB/phpbb/console/command/reparser/reparse.php b/phpBB/phpbb/console/command/reparser/reparse.php index f285977ea2..daefd4cebc 100644 --- a/phpBB/phpbb/console/command/reparser/reparse.php +++ b/phpBB/phpbb/console/command/reparser/reparse.php @@ -14,6 +14,7 @@ namespace phpbb\console\command\reparser; use phpbb\exception\runtime_exception; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; @@ -157,7 +158,7 @@ class reparse extends \phpbb\console\command\command $this->reparse_lock->release(); - return 0; + return symfony_command::SUCCESS; } /** diff --git a/phpBB/phpbb/console/command/thumbnail/delete.php b/phpBB/phpbb/console/command/thumbnail/delete.php index fe466835e7..1fca707eed 100644 --- a/phpBB/phpbb/console/command/thumbnail/delete.php +++ b/phpBB/phpbb/console/command/thumbnail/delete.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\thumbnail; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; @@ -90,7 +91,7 @@ class delete extends \phpbb\console\command\command if ($nb_missing_thumbnails === 0) { $io->warning($this->user->lang('CLI_THUMBNAIL_NOTHING_TO_DELETE')); - return 0; + return symfony_command::SUCCESS; } $sql = 'SELECT attach_id, physical_filename, extension, real_filename, mimetype @@ -105,7 +106,7 @@ class delete extends \phpbb\console\command\command $progress->start(); $thumbnail_deleted = array(); - $return = 0; + $return = symfony_command::SUCCESS; while ($row = $this->db->sql_fetchrow($result)) { $thumbnail_path = $this->phpbb_root_path . $this->config['upload_path'] . '/thumb_' . $row['physical_filename']; @@ -124,7 +125,7 @@ class delete extends \phpbb\console\command\command } else { - $return = 1; + $return = symfony_command::FAILURE; $progress->setMessage('' . $this->user->lang('CLI_THUMBNAIL_SKIPPED', $row['real_filename'], $row['physical_filename']) . ''); } diff --git a/phpBB/phpbb/console/command/thumbnail/generate.php b/phpBB/phpbb/console/command/thumbnail/generate.php index 0eec0c30ce..13104c201f 100644 --- a/phpBB/phpbb/console/command/thumbnail/generate.php +++ b/phpBB/phpbb/console/command/thumbnail/generate.php @@ -13,6 +13,7 @@ namespace phpbb\console\command\thumbnail; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; @@ -107,7 +108,7 @@ class generate extends \phpbb\console\command\command if ($nb_missing_thumbnails === 0) { $io->warning($this->user->lang('CLI_THUMBNAIL_NOTHING_TO_GENERATE')); - return 0; + return symfony_command::SUCCESS; } $extensions = $this->cache->obtain_attach_extensions(true); @@ -168,7 +169,7 @@ class generate extends \phpbb\console\command\command $io->newLine(2); $io->success($this->user->lang('CLI_THUMBNAIL_GENERATING_DONE')); - return 0; + return symfony_command::SUCCESS; } /** diff --git a/phpBB/phpbb/console/command/thumbnail/recreate.php b/phpBB/phpbb/console/command/thumbnail/recreate.php index 382da290bf..ff7c41bbd3 100644 --- a/phpBB/phpbb/console/command/thumbnail/recreate.php +++ b/phpBB/phpbb/console/command/thumbnail/recreate.php @@ -12,6 +12,7 @@ */ namespace phpbb\console\command\thumbnail; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\OutputInterface; @@ -57,7 +58,7 @@ class recreate extends \phpbb\console\command\command $input_delete = new ArrayInput($parameters); $return = $this->getApplication()->run($input_delete, $output); - if ($return === 0) + if ($return === symfony_command::SUCCESS) { $parameters['command'] = 'thumbnail:generate'; diff --git a/phpBB/phpbb/console/command/update/check.php b/phpBB/phpbb/console/command/update/check.php index d3f407c952..e7ca92e813 100644 --- a/phpBB/phpbb/console/command/update/check.php +++ b/phpBB/phpbb/console/command/update/check.php @@ -17,6 +17,7 @@ use phpbb\config\config; use phpbb\exception\exception_interface; use phpbb\language\language; use phpbb\user; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; @@ -155,7 +156,7 @@ class check extends \phpbb\console\command\command $this->display_versions($io, $updates_available); } - return 1; + return symfony_command::FAILURE; } else { @@ -164,14 +165,14 @@ class check extends \phpbb\console\command\command $io->success($this->language->lang('UPDATE_NOT_NEEDED')); } - return 0; + return symfony_command::SUCCESS; } } catch (\RuntimeException $e) { $io->error($this->language->lang('EXTENSION_NOT_INSTALLED', $ext_name)); - return 1; + return symfony_command::FAILURE; } } @@ -207,7 +208,7 @@ class check extends \phpbb\console\command\command $this->display_versions($io, $updates_available); } - return 1; + return symfony_command::FAILURE; } else { @@ -216,7 +217,7 @@ class check extends \phpbb\console\command\command $io->success($this->language->lang('UPDATE_NOT_NEEDED')); } - return 0; + return symfony_command::SUCCESS; } } @@ -292,7 +293,7 @@ class check extends \phpbb\console\command\command $this->language->lang('LATEST_VERSION'), ], $rows); - return 0; + return symfony_command::SUCCESS; } /** diff --git a/phpBB/phpbb/console/command/user/activate.php b/phpBB/phpbb/console/command/user/activate.php index 5cfd2d8bac..34fc94447c 100644 --- a/phpBB/phpbb/console/command/user/activate.php +++ b/phpBB/phpbb/console/command/user/activate.php @@ -20,6 +20,7 @@ use phpbb\log\log_interface; use phpbb\notification\manager; use phpbb\user; use phpbb\user_loader; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -137,19 +138,19 @@ class activate extends command if ($user_row['user_id'] == ANONYMOUS) { $io->error($this->language->lang('NO_USER')); - return 1; + return symfony_command::FAILURE; } // Check if the user is already active (or inactive) if ($mode == 'activate' && $user_row['user_type'] != USER_INACTIVE) { $io->error($this->language->lang('CLI_DESCRIPTION_USER_ACTIVATE_ACTIVE')); - return 1; + return symfony_command::FAILURE; } else if ($mode == 'deactivate' && $user_row['user_type'] == USER_INACTIVE) { $io->error($this->language->lang('CLI_DESCRIPTION_USER_ACTIVATE_INACTIVE')); - return 1; + return symfony_command::FAILURE; } // Activate the user account @@ -177,7 +178,7 @@ class activate extends command $io->success($this->language->lang($msg)); - return 0; + return symfony_command::SUCCESS; } /** diff --git a/phpBB/phpbb/console/command/user/add.php b/phpBB/phpbb/console/command/user/add.php index 10eb8c60ea..c846d2158a 100644 --- a/phpBB/phpbb/console/command/user/add.php +++ b/phpBB/phpbb/console/command/user/add.php @@ -20,6 +20,7 @@ use phpbb\exception\runtime_exception; use phpbb\language\language; use phpbb\passwords\manager; use phpbb\user; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -142,7 +143,7 @@ class add extends command catch (runtime_exception $e) { $io->error($e->getMessage()); - return 1; + return symfony_command::FAILURE; } $user_row = array( @@ -161,7 +162,7 @@ class add extends command if (!$user_id) { $io->error($this->language->lang('AUTH_NO_PROFILE_CREATED')); - return 1; + return symfony_command::FAILURE; } if ($input->getOption('send-email') && $this->config['email_enable']) @@ -171,7 +172,7 @@ class add extends command $io->success($this->language->lang('CLI_USER_ADD_SUCCESS', $this->data['username'])); - return 0; + return symfony_command::SUCCESS; } /** diff --git a/phpBB/phpbb/console/command/user/delete.php b/phpBB/phpbb/console/command/user/delete.php index dc06633fae..abda29fedf 100644 --- a/phpBB/phpbb/console/command/user/delete.php +++ b/phpBB/phpbb/console/command/user/delete.php @@ -18,6 +18,7 @@ use phpbb\language\language; use phpbb\log\log_interface; use phpbb\user; use phpbb\user_loader; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -122,7 +123,7 @@ class delete extends command if ($user_row['user_id'] == ANONYMOUS) { $io->error($this->language->lang('NO_USER')); - return 1; + return symfony_command::FAILURE; } if (!function_exists('user_delete')) @@ -137,7 +138,7 @@ class delete extends command $io->success($this->language->lang('USER_DELETED')); } - return 0; + return symfony_command::SUCCESS; } /** diff --git a/phpBB/phpbb/console/command/user/reclean.php b/phpBB/phpbb/console/command/user/reclean.php index 1a89f13382..6ad5ac4f92 100644 --- a/phpBB/phpbb/console/command/user/reclean.php +++ b/phpBB/phpbb/console/command/user/reclean.php @@ -17,6 +17,7 @@ use phpbb\console\command\command; use phpbb\db\driver\driver_interface; use phpbb\language\language; use phpbb\user; +use Symfony\Component\Console\Command\Command as symfony_command; use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -98,7 +99,7 @@ class reclean extends command $io->newLine(2); $io->success($this->language->lang('CLI_USER_RECLEAN_DONE', $this->processed)); - return 0; + return symfony_command::SUCCESS; } /** diff --git a/phpBB/phpbb/cron/event/cron_runner_listener.php b/phpBB/phpbb/cron/event/cron_runner_listener.php index c9c13ddc06..27450e0abd 100644 --- a/phpBB/phpbb/cron/event/cron_runner_listener.php +++ b/phpBB/phpbb/cron/event/cron_runner_listener.php @@ -18,7 +18,7 @@ use phpbb\lock\db; use phpbb\request\request_interface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\PostResponseEvent; +use Symfony\Component\HttpKernel\Event\TerminateEvent; /** * Event listener that executes cron tasks, after the response was served @@ -57,9 +57,9 @@ class cron_runner_listener implements EventSubscriberInterface /** * Runs the cron job after the response was sent * - * @param PostResponseEvent $event The event + * @param TerminateEvent $event The event */ - public function on_kernel_terminate(PostResponseEvent $event) + public function on_kernel_terminate(TerminateEvent $event) { $request = $event->getRequest(); $controller_name = $request->get('_route'); diff --git a/phpBB/phpbb/di/extension/container_configuration.php b/phpBB/phpbb/di/extension/container_configuration.php index dafdd548eb..697f083a4e 100644 --- a/phpBB/phpbb/di/extension/container_configuration.php +++ b/phpBB/phpbb/di/extension/container_configuration.php @@ -26,8 +26,8 @@ class container_configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('core'); + $treeBuilder = new TreeBuilder('core'); + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() ->booleanNode('require_dev_dependencies')->defaultValue(false)->end() diff --git a/phpBB/phpbb/event/data.php b/phpBB/phpbb/event/data.php index 276ab027f2..6095903067 100644 --- a/phpBB/phpbb/event/data.php +++ b/phpBB/phpbb/event/data.php @@ -13,7 +13,7 @@ namespace phpbb\event; -use Symfony\Component\EventDispatcher\Event; +use Symfony\Contracts\EventDispatcher\Event; class data extends Event implements \ArrayAccess { diff --git a/phpBB/phpbb/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php index 516a94cb3f..7b85edf600 100644 --- a/phpBB/phpbb/event/dispatcher.php +++ b/phpBB/phpbb/event/dispatcher.php @@ -14,7 +14,6 @@ namespace phpbb\event; use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\Event; /** * Extension of the Symfony EventDispatcher @@ -43,26 +42,24 @@ class dispatcher extends EventDispatcher implements dispatcher_interface public function trigger_event($eventName, $data = []) { $event = new \phpbb\event\data($data); - $this->dispatch($eventName, $event); + foreach ((array) $eventName as $name) + { + $this->dispatch($event, $name); + } return $event->get_data_filtered(array_keys($data)); } /** * {@inheritdoc} */ - public function dispatch($eventName, Event $event = null) + public function dispatch(object $event, string $eventName = null) : object { if ($this->disabled) { return $event; } - foreach ((array) $eventName as $name) - { - $event = parent::dispatch($name, $event); - } - - return $event; + return parent::dispatch($event, $eventName); } /** diff --git a/phpBB/phpbb/event/kernel_exception_subscriber.php b/phpBB/phpbb/event/kernel_exception_subscriber.php index 373e59b0c8..6b16d6d512 100644 --- a/phpBB/phpbb/event/kernel_exception_subscriber.php +++ b/phpBB/phpbb/event/kernel_exception_subscriber.php @@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpFoundation\Response; class kernel_exception_subscriber implements EventSubscriberInterface @@ -65,12 +65,12 @@ class kernel_exception_subscriber implements EventSubscriberInterface /** * This listener is run when the KernelEvents::EXCEPTION event is triggered * - * @param GetResponseForExceptionEvent $event + * @param ExceptionEvent $event * @return null */ - public function on_kernel_exception(GetResponseForExceptionEvent $event) + public function on_kernel_exception(ExceptionEvent $event) { - $exception = $event->getException(); + $exception = $event->getThrowable(); $message = $exception->getMessage(); $this->type_caster->set_var($message, $message, 'string', true, false); diff --git a/phpBB/phpbb/event/kernel_terminate_subscriber.php b/phpBB/phpbb/event/kernel_terminate_subscriber.php index eb7b16a7aa..68c38a3ba6 100644 --- a/phpBB/phpbb/event/kernel_terminate_subscriber.php +++ b/phpBB/phpbb/event/kernel_terminate_subscriber.php @@ -15,7 +15,7 @@ namespace phpbb\event; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\PostResponseEvent; +use Symfony\Component\HttpKernel\Event\TerminateEvent; class kernel_terminate_subscriber implements EventSubscriberInterface { @@ -24,10 +24,10 @@ class kernel_terminate_subscriber implements EventSubscriberInterface * This comes after a Response has been sent to the server; this is * primarily cleanup stuff. * - * @param PostResponseEvent $event + * @param TerminateEvent $event * @return void */ - public function on_kernel_terminate(PostResponseEvent $event) + public function on_kernel_terminate(TerminateEvent $event) { garbage_collection(); diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php index 71c94a681d..a68618d434 100644 --- a/phpBB/phpbb/event/php_exporter.php +++ b/phpBB/phpbb/event/php_exporter.php @@ -203,16 +203,20 @@ class php_exporter { $event_line = false; $found_trigger_event = strpos($this->file_lines[$i], 'dispatcher->trigger_event('); + $found_use_vars = strpos($this->file_lines[$i], ', compact($vars)'); $arguments = array(); if ($found_trigger_event !== false) { $event_line = $i; $this->set_current_event($this->get_event_name($event_line, false), $event_line); - // Find variables of the event - $arguments = $this->get_vars_from_array(); - $doc_vars = $this->get_vars_from_docblock(); - $this->validate_vars_docblock_array($arguments, $doc_vars); + if ($found_use_vars) + { + // Find variables of the event + $arguments = $this->get_vars_from_array(); + $doc_vars = $this->get_vars_from_docblock(); + $this->validate_vars_docblock_array($arguments, $doc_vars); + } } else { @@ -346,10 +350,10 @@ class php_exporter } else { - $regex = '#extract\(\$[a-z](?:[a-z0-9_]|->)*'; + $regex = '#(?:extract\()?\$[a-z](?:[a-z0-9_]|->)*'; $regex .= '->trigger_event\((\[)?'; $regex .= '\'' . $this->preg_match_event_name() . '(?(1)\', \'(?2))+\''; - $regex .= '(?(1)\]), compact\(\$vars\)\)\);#'; + $regex .= '(?(1)\])(?:, compact\(\$vars\)\))?\);#'; } $match = array(); diff --git a/phpBB/phpbb/filesystem/helper.php b/phpBB/phpbb/filesystem/helper.php index 0843e077ad..f1a123cfd6 100644 --- a/phpBB/phpbb/filesystem/helper.php +++ b/phpBB/phpbb/filesystem/helper.php @@ -212,6 +212,18 @@ class helper */ public static function make_path_relative($end_path, $start_path) { + // Ensure paths are absolute as passing relative paths to the + // Symsony's Filesystem::makePathRelative() method is removed since Symfony 4.0 + if (!self::is_absolute_path($end_path)) + { + $end_path = self::phpbb_own_realpath($end_path); + } + + if (!self::is_absolute_path($start_path)) + { + $start_path = self::phpbb_own_realpath($start_path); + } + return self::get_symfony_filesystem()->makePathRelative($end_path, $start_path); } diff --git a/phpBB/phpbb/install/helper/container_factory.php b/phpBB/phpbb/install/helper/container_factory.php index af7d4054bd..e689e44cde 100644 --- a/phpBB/phpbb/install/helper/container_factory.php +++ b/phpBB/phpbb/install/helper/container_factory.php @@ -161,7 +161,7 @@ class container_factory // Setting request is required for the compatibility globals as those are generated from // this container - if (!$this->container->isFrozen()) + if (!$this->container->isCompiled()) { $this->container->register('request')->setSynthetic(true); $this->container->register('language')->setSynthetic(true); diff --git a/phpBB/phpbb/mimetype/guesser.php b/phpBB/phpbb/mimetype/guesser.php index f8cbffe8f5..9b2c184eeb 100644 --- a/phpBB/phpbb/mimetype/guesser.php +++ b/phpBB/phpbb/mimetype/guesser.php @@ -49,6 +49,7 @@ class guesser { $is_supported = (method_exists($guesser, 'is_supported')) ? 'is_supported' : ''; $is_supported = (method_exists($guesser, 'isSupported')) ? 'isSupported' : $is_supported; + $is_supported = (method_exists($guesser, 'isGuesserSupported')) ? 'isGuesserSupported' : $is_supported; if (empty($is_supported)) { @@ -117,9 +118,13 @@ class guesser $mimetype = 'application/octet-stream'; + $args = (array) func_get_args(); foreach ($this->guessers as $guesser) { - $mimetype_guess = $guesser->guess($file, $file_name); + $guess = (method_exists($guesser, 'guess')) ? 'guess' : ''; + $guess = (method_exists($guesser, 'guessMimeType')) ? 'guessMimeType' : $guess; + + $mimetype_guess = $guesser->$guess(...$args); $mimetype = $this->choose_mime_type($mimetype, $mimetype_guess); } diff --git a/phpBB/phpbb/routing/router.php b/phpBB/phpbb/routing/router.php index 9bd9a6bb36..18285c06d5 100644 --- a/phpBB/phpbb/routing/router.php +++ b/phpBB/phpbb/routing/router.php @@ -20,9 +20,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\Filesystem\Exception\IOException; -use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper; +use Symfony\Component\Routing\Generator\Dumper\CompiledUrlGeneratorDumper; +use Symfony\Component\Routing\Generator\CompiledUrlGenerator; use Symfony\Component\Routing\Generator\UrlGenerator; -use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper; +use Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherDumper; +use Symfony\Component\Routing\Matcher\CompiledUrlMatcher; use Symfony\Component\Routing\Matcher\UrlMatcher; use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\RouteCollection; @@ -217,19 +219,12 @@ class router implements RouterInterface $cache = new ConfigCache("{$this->cache_dir}url_matcher.{$this->php_ext}", $this->debug_url_matcher); if (!$cache->isFresh()) { - $dumper = new PhpMatcherDumper($this->get_routes()); - - $options = array( - 'class' => 'phpbb_url_matcher', - 'base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher', - ); - - $cache->write($dumper->dump($options), $this->get_routes()->getResources()); + $dumper = new CompiledUrlMatcherDumper($this->get_routes()); + $cache->write($dumper->dump(), $this->get_routes()->getResources()); } - require_once($cache->getPath()); - - $this->matcher = new \phpbb_url_matcher($this->context); + $compiled_routes = require_once($cache->getPath()); + $this->matcher = new CompiledUrlMatcher($compiled_routes, $this->context); } catch (IOException $e) { @@ -272,19 +267,12 @@ class router implements RouterInterface $cache = new ConfigCache("{$this->cache_dir}url_generator.{$this->php_ext}", $this->debug_url_generator); if (!$cache->isFresh()) { - $dumper = new PhpGeneratorDumper($this->get_routes()); - - $options = array( - 'class' => 'phpbb_url_generator', - 'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', - ); - - $cache->write($dumper->dump($options), $this->get_routes()->getResources()); + $dumper = new CompiledUrlGeneratorDumper($this->get_routes()); + $cache->write($dumper->dump(), $this->get_routes()->getResources()); } - require_once($cache->getPath()); - - $this->generator = new \phpbb_url_generator($this->context); + $compiled_routes = require_once($cache->getPath()); + $this->generator = new CompiledUrlGenerator($compiled_routes, $this->context); } catch (IOException $e) { diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 1ba29f81c9..e3dcd3a37f 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1054,7 +1054,7 @@ class session * @event core.session_gc_after * @since 3.1.6-RC1 */ - $phpbb_dispatcher->dispatch('core.session_gc_after'); + $phpbb_dispatcher->trigger_event('core.session_gc_after'); return; } diff --git a/phpBB/phpbb/template/twig/extension/avatar.php b/phpBB/phpbb/template/twig/extension/avatar.php index c699fcf5b3..d8b27fed9f 100644 --- a/phpBB/phpbb/template/twig/extension/avatar.php +++ b/phpBB/phpbb/template/twig/extension/avatar.php @@ -13,7 +13,9 @@ namespace phpbb\template\twig\extension; -class avatar extends \Twig_Extension +use Twig\Extension\AbstractExtension; + +class avatar extends AbstractExtension { /** * Get the name of this extension diff --git a/phpBB/phpbb/template/twig/extension/config.php b/phpBB/phpbb/template/twig/extension/config.php index a752890fe6..a7f1189d27 100644 --- a/phpBB/phpbb/template/twig/extension/config.php +++ b/phpBB/phpbb/template/twig/extension/config.php @@ -13,7 +13,9 @@ namespace phpbb\template\twig\extension; -class config extends \Twig_Extension +use Twig\Extension\AbstractExtension; + +class config extends AbstractExtension { /** @var \phpbb\config\config */ protected $config; diff --git a/phpBB/phpbb/template/twig/extension/icon.php b/phpBB/phpbb/template/twig/extension/icon.php index 3869c63b2e..0bd52d6ad9 100644 --- a/phpBB/phpbb/template/twig/extension/icon.php +++ b/phpBB/phpbb/template/twig/extension/icon.php @@ -14,8 +14,9 @@ namespace phpbb\template\twig\extension; use phpbb\template\twig\environment; +use Twig\Extension\AbstractExtension; -class icon extends \Twig\Extension\AbstractExtension +class icon extends AbstractExtension { /** @var \phpbb\user */ protected $user; diff --git a/phpBB/phpbb/template/twig/extension/routing.php b/phpBB/phpbb/template/twig/extension/routing.php index 829ce738eb..9c404e55d3 100644 --- a/phpBB/phpbb/template/twig/extension/routing.php +++ b/phpBB/phpbb/template/twig/extension/routing.php @@ -13,10 +13,14 @@ namespace phpbb\template\twig\extension; -use Symfony\Bridge\Twig\Extension\RoutingExtension; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Twig\Extension\AbstractExtension; +use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Node; +use Twig\TwigFunction; -class routing extends RoutingExtension +class routing extends AbstractExtension { /** @var \phpbb\controller\helper */ protected $helper; @@ -31,6 +35,17 @@ class routing extends RoutingExtension $this->helper = $helper; } + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('url', [$this, 'getUrl'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]), + new TwigFunction('path', [$this, 'getPath'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]), + ]; + } + public function getPath($name, $parameters = array(), $relative = false) { return $this->helper->route($name, $parameters, true, false, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH); @@ -40,4 +55,47 @@ class routing extends RoutingExtension { return $this->helper->route($name, $parameters, true, false, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL); } + + /** + * Borrowed from the Symfony Twig bridge routing extension + * + * @author Fabien Potencier + * + * Determines at compile time whether the generated URL will be safe and thus + * saving the unneeded automatic escaping for performance reasons. + * + * The URL generation process percent encodes non-alphanumeric characters. So there is no risk + * that malicious/invalid characters are part of the URL. The only character within an URL that + * must be escaped in html is the ampersand ("&") which separates query params. So we cannot mark + * the URL generation as always safe, but only when we are sure there won't be multiple query + * params. This is the case when there are none or only one constant parameter given. + * E.g. we know beforehand this will be safe: + * - path('route') + * - path('route', {'param': 'value'}) + * But the following may not: + * - path('route', var) + * - path('route', {'param': ['val1', 'val2'] }) // a sub-array + * - path('route', {'param1': 'value1', 'param2': 'value2'}) + * If param1 and param2 reference placeholder in the route, it would still be safe. But we don't know. + * + * @param Node $argsNode The arguments of the path/url function + * + * @return array An array with the contexts the URL is safe + */ + public function isUrlGenerationSafe(Node $argsNode): array + { + // support named arguments + $paramsNode = $argsNode->hasNode('parameters') ? $argsNode->getNode('parameters') : ( + $argsNode->hasNode(1) ? $argsNode->getNode(1) : null + ); + + if (null === $paramsNode || $paramsNode instanceof ArrayExpression && \count($paramsNode) <= 2 && + (!$paramsNode->hasNode(1) || $paramsNode->getNode(1) instanceof ConstantExpression) + ) + { + return ['html']; + } + + return []; + } } diff --git a/phpBB/phpbb/template/twig/extension/username.php b/phpBB/phpbb/template/twig/extension/username.php index f419c6ff0f..83cbebe29a 100644 --- a/phpBB/phpbb/template/twig/extension/username.php +++ b/phpBB/phpbb/template/twig/extension/username.php @@ -13,7 +13,9 @@ namespace phpbb\template\twig\extension; -class username extends \Twig_Extension +use Twig\Extension\AbstractExtension; + +class username extends AbstractExtension { /** * Get the name of this extension diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index fb3f666426..6b3b2044e5 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -342,7 +342,7 @@ class user extends \phpbb\session * @event core.user_setup_after * @since 3.1.6-RC1 */ - $phpbb_dispatcher->dispatch('core.user_setup_after'); + $phpbb_dispatcher->trigger_event('core.user_setup_after'); // If this function got called from the error handler we are finished here. if (defined('IN_ERROR_HANDLER')) diff --git a/tests/attachment/upload_test.php b/tests/attachment/upload_test.php index 69714d93f9..ba23db0414 100644 --- a/tests/attachment/upload_test.php +++ b/tests/attachment/upload_test.php @@ -93,8 +93,8 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; $guessers = array( - new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(), - new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(), + new \Symfony\Component\Mime\FileinfoMimeTypeGuesser(), + new \Symfony\Component\Mime\FileBinaryMimeTypeGuesser(), new \phpbb\mimetype\content_guesser(), new \phpbb\mimetype\extension_guesser(), ); diff --git a/tests/console/cache/purge_test.php b/tests/console/cache/purge_test.php index 95525bd933..420b213fd1 100644 --- a/tests/console/cache/purge_test.php +++ b/tests/console/cache/purge_test.php @@ -28,6 +28,8 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case protected function setUp(): void { + global $phpbb_root_path, $phpEx; + $this->cache_dir = dirname(__FILE__) . '/tmp/cache/'; if (file_exists($this->cache_dir)) @@ -43,7 +45,8 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case $this->db = $this->createMock('\phpbb\db\driver\driver_interface'); $this->config = new \phpbb\config\config(array('assets_version' => 1)); - $this->user = $this->createMock('\phpbb\user'); + $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + $this->user = new \phpbb\user($this->language, '\phpbb\datetime'); } public function test_purge() diff --git a/tests/console/thumbnail_test.php b/tests/console/thumbnail_test.php index cbe743bdef..0d8885f4b5 100644 --- a/tests/console/thumbnail_test.php +++ b/tests/console/thumbnail_test.php @@ -50,7 +50,8 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case )); $this->db = $this->db = $this->new_dbal(); - $this->user = $this->createMock('\phpbb\user'); + $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); + $this->user = new \phpbb\user($this->language, '\phpbb\datetime'); $this->phpbb_root_path = $phpbb_root_path; $this->phpEx = $phpEx; diff --git a/tests/console/user/add_test.php b/tests/console/user/add_test.php index 126771c7c6..8cdb706cf6 100644 --- a/tests/console/user/add_test.php +++ b/tests/console/user/add_test.php @@ -106,7 +106,7 @@ class phpbb_console_user_add_test extends phpbb_console_user_base $this->assertEquals(2, $this->get_user_id('Admin')); - $this->question->setInputStream($this->getInputStream("bar\npassword\npassword\nbar@test.com\n")); + $command_tester->setInputs(['bar\npassword\npassword\nbar@test.com']); $command_tester->execute(array( 'command' => $this->command_name, diff --git a/tests/console/user/base.php b/tests/console/user/base.php index fd8acf935c..31999d4865 100644 --- a/tests/console/user/base.php +++ b/tests/console/user/base.php @@ -117,13 +117,4 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case $user_id = $row ? $row['user_id'] : null; return $user_id; } - - public function getInputStream($input) - { - $stream = fopen('php://memory', 'r+', false); - fputs($stream, $input); - rewind($stream); - - return $stream; - } } diff --git a/tests/controller/config/services.yml b/tests/controller/config/services.yml index e4412af3d7..4a86537e62 100644 --- a/tests/controller/config/services.yml +++ b/tests/controller/config/services.yml @@ -1,3 +1,4 @@ services: + _defaults: { public: true } core_foo.controller: class: phpbb\controller\foo diff --git a/tests/controller/ext/vendor2/bar/config/services.yml b/tests/controller/ext/vendor2/bar/config/services.yml index 05a8a1994d..569b9432be 100644 --- a/tests/controller/ext/vendor2/bar/config/services.yml +++ b/tests/controller/ext/vendor2/bar/config/services.yml @@ -1,3 +1,4 @@ services: + _defaults: { public: true } bar.controller: class: bar\controller diff --git a/tests/controller/ext/vendor2/foo/config/services.yml b/tests/controller/ext/vendor2/foo/config/services.yml index 9ed67d5bc2..47eaf62210 100644 --- a/tests/controller/ext/vendor2/foo/config/services.yml +++ b/tests/controller/ext/vendor2/foo/config/services.yml @@ -1,3 +1,4 @@ services: + _defaults: { public: true } foo.controller: class: foo\controller diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php index bb87a57a7b..170e9be214 100644 --- a/tests/di/create_container_test.php +++ b/tests/di/create_container_test.php @@ -52,7 +52,7 @@ namespace $this->assertTrue($container->hasParameter('core')); // Checks compile_container - $this->assertTrue($container->isFrozen()); + $this->assertTrue($container->isCompiled()); // Checks inject_config $this->assertTrue($container->hasParameter('core.table_prefix')); @@ -74,7 +74,7 @@ namespace // Checks the construction of a dumped container $container = $this->builder->get_container(); $this->assertInstanceOf('phpbb_cache_container', $container); - $this->assertTrue($container->isFrozen()); + $this->assertTrue($container->isCompiled()); } public function test_tables_mapping() @@ -102,7 +102,7 @@ namespace $container = $this->builder->get_container(); $this->assertNotInstanceOf('phpbb_cache_container', $container); $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); - $this->assertTrue($container->isFrozen()); + $this->assertTrue($container->isCompiled()); } public function test_without_extensions() @@ -127,7 +127,7 @@ namespace $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); // Checks compile_container - $this->assertFalse($container->isFrozen()); + $this->assertFalse($container->isCompiled()); } public function test_with_config_path() diff --git a/tests/di/fixtures/config/production/container/environment.yml b/tests/di/fixtures/config/production/container/environment.yml index 2792b24162..c9316ee100 100644 --- a/tests/di/fixtures/config/production/container/environment.yml +++ b/tests/di/fixtures/config/production/container/environment.yml @@ -5,6 +5,7 @@ parameters: tables.acl_roles: '%core.table_prefix%acl_roles' services: + _defaults: { public: true } config.php: synthetic: true diff --git a/tests/di/fixtures/config/test/container/environment.yml b/tests/di/fixtures/config/test/container/environment.yml index 356eb4b008..70f49c6e1a 100644 --- a/tests/di/fixtures/config/test/container/environment.yml +++ b/tests/di/fixtures/config/test/container/environment.yml @@ -5,6 +5,7 @@ parameters: tables.acl_roles: '%core.table_prefix%acl_roles' services: + _defaults: { public: true } config.php: synthetic: true diff --git a/tests/di/fixtures/other_config/production/container/environment.yml b/tests/di/fixtures/other_config/production/container/environment.yml index aeb552eeb7..4944010ad7 100644 --- a/tests/di/fixtures/other_config/production/container/environment.yml +++ b/tests/di/fixtures/other_config/production/container/environment.yml @@ -2,6 +2,7 @@ parameters: other_config: true services: + _defaults: { public: true } config.php: synthetic: true diff --git a/tests/di/fixtures/other_config/test/container/environment.yml b/tests/di/fixtures/other_config/test/container/environment.yml index b9f6d05018..766717fa61 100644 --- a/tests/di/fixtures/other_config/test/container/environment.yml +++ b/tests/di/fixtures/other_config/test/container/environment.yml @@ -2,6 +2,7 @@ parameters: other_config: true services: + _defaults: { public: true } config.php: synthetic: true diff --git a/tests/event/exception_listener_test.php b/tests/event/exception_listener_test.php index 346bc5f3ec..75c3704f74 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->createMock('Symfony\Component\HttpKernel\HttpKernelInterface'), $request, \Symfony\Component\HttpKernel\HttpKernelInterface::MASTER_REQUEST, $exception); + $event = new \Symfony\Component\HttpKernel\Event\ExceptionEvent($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/functional/controllers_compatibility_test.php b/tests/functional/controllers_compatibility_test.php index 36a34aa7c8..03fe6f07ef 100644 --- a/tests/functional/controllers_compatibility_test.php +++ b/tests/functional/controllers_compatibility_test.php @@ -58,7 +58,7 @@ class phpbb_functional_controllers_compatibility_test extends phpbb_functional_t $location = substr($location, 0, -1); } - $this->assertEquals(301, self::$client->getResponse()->getStatus()); + $this->assertEquals(301, self::$client->getResponse()->getStatusCode()); $this->assertStringEndsWith($to, $location); } } diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 17b5803041..75ab51091d 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -107,7 +107,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c $this->phpbb_extension_manager->enable('foo/bar'); $crawler = self::request('GET', 'app.php/foo/baz', array(), false); $this->assert_response_html(500); - $this->assertStringContainsString('Missing value for argument #1: test in class foo\bar\controller\controller:baz', $crawler->filter('body')->text()); + $this->assertStringContainsString('Controller "foo\bar\controller\controller::baz()" requires that you provide a value for the "$test" argument', $crawler->filter('body')->text()); $this->phpbb_extension_manager->purge('foo/bar'); } diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php index 16ef468eea..159703744f 100644 --- a/tests/functional/feed_test.php +++ b/tests/functional/feed_test.php @@ -51,14 +51,14 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case self::$init_values['topic_base_items'] = (int) $values['config[feed_limit_topic]']; // Enable all feeds - $values['config[feed_enable]'] = true; - $values['config[feed_forum]'] = true; - $values['config[feed_item_statistics]'] = true; - $values['config[feed_overall]'] = true; - $values['config[feed_overall_forums]'] = true; - $values['config[feed_topic]'] = true; - $values['config[feed_topics_active]'] = true; - $values['config[feed_topics_new]'] = true; + $values['config[feed_enable]'] = 1; + $values['config[feed_forum]'] = 1; + $values['config[feed_item_statistics]'] = 1; + $values['config[feed_overall]'] = 1; + $values['config[feed_overall_forums]'] = 1; + $values['config[feed_topic]'] = 1; + $values['config[feed_topics_active]'] = 1; + $values['config[feed_topics_new]'] = 1; $form->setValues($values); @@ -68,7 +68,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case // Disable showing unapproved posts to users $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=acp_board&mode=features"); $form = $crawler->selectButton('Submit')->form(); - $form->setValues(['config[display_unapproved_posts]' => false]); + $form->setValues(['config[display_unapproved_posts]' => 0]); $crawler = self::submit($form); self::assertContainsLang('CONFIG_UPDATED', $crawler->filter('.successbox')->text()); diff --git a/tests/functional/fixtures/ext/foo/bar/config/services.yml b/tests/functional/fixtures/ext/foo/bar/config/services.yml index 495c775a1f..e5353ed0e9 100644 --- a/tests/functional/fixtures/ext/foo/bar/config/services.yml +++ b/tests/functional/fixtures/ext/foo/bar/config/services.yml @@ -1,4 +1,5 @@ services: + _defaults: { public: true } foo_bar.controller: class: foo\bar\controller\controller arguments: diff --git a/tests/functional/fixtures/ext/foo/foo/config/services.yml b/tests/functional/fixtures/ext/foo/foo/config/services.yml index b3c7719715..3f15226b85 100644 --- a/tests/functional/fixtures/ext/foo/foo/config/services.yml +++ b/tests/functional/fixtures/ext/foo/foo/config/services.yml @@ -1,3 +1,4 @@ services: + _defaults: { public: true } foo_foo.controller: class: foo\foo\controller\controller diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 38edcf6767..7a6559f293 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -70,7 +70,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case public function test_quote() { $text = 'Test post "\' &&amp;'; - $expected = "(\\[quote=admin[^\\]]*\\]\n" . preg_quote($text) . "\n\\[/quote\\])"; + $expected = "(\[quote=admin[^\]]*\]\s?" . preg_quote($text) . "\s?\[\/quote\])"; $this->login(); $topic = $this->create_topic(2, 'Test Topic 1', 'Test topic'); @@ -123,7 +123,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case $this->set_quote_depth($quote_depth); $crawler = self::request('GET', $quote_url); $this->assertRegexp( - "(\\[quote=admin[^\\]]*\\]\n?" . preg_quote($expected_text) . "\n?\\[/quote\\])", + "(\[quote=admin[^\]]*\]\s?" . preg_quote($expected_text) . "\s?\[\/quote\])", $crawler->filter('textarea#message')->text() ); } diff --git a/tests/functional/private_messages_test.php b/tests/functional/private_messages_test.php index 6f94eac35c..087f6d5891 100644 --- a/tests/functional/private_messages_test.php +++ b/tests/functional/private_messages_test.php @@ -85,7 +85,7 @@ class phpbb_functional_private_messages_test extends phpbb_functional_test_case public function test_quote_pm() { $text = 'This is a test private message sent by the testing framework.'; - $expected = "(\\[quote=admin msg_id=\\d+ time=\\d+ user_id=2\\]\n" . $text . "\n\\[/quote\\])"; + $expected = "(\[quote=admin msg_id=[\d]+ time=[\d]+ user_id=2\]\s?" . $text . "\s?\[\/quote\])"; $this->login(); $message_id = $this->create_private_message('Test', $text, array(2)); @@ -98,13 +98,13 @@ class phpbb_functional_private_messages_test extends phpbb_functional_test_case public function test_quote_forward() { $text = 'This is a test private message sent by the testing framework.'; - $expected = "[quote=admin]\n" . $text . "\n[/quote]"; + $expected = "(\[quote=admin\]\s?" . $text . "\s?\[\/quote\])"; $this->login(); $message_id = $this->create_private_message('Test', $text, array(2)); $crawler = self::request('GET', 'ucp.php?i=pm&mode=compose&action=forward&f=0&p=' . $message_id . '&sid=' . $this->sid); - $this->assertStringContainsString($expected, $crawler->filter('textarea#message')->text()); + $this->assertRegexp($expected, $crawler->filter('textarea#message')->text()); } } diff --git a/tests/mimetype/guesser_test.php b/tests/mimetype/guesser_test.php index 2b6423f1ee..5f3c07ab46 100644 --- a/tests/mimetype/guesser_test.php +++ b/tests/mimetype/guesser_test.php @@ -32,14 +32,14 @@ class guesser_test extends \phpbb_test_case global $phpbb_root_path; $guessers = array( - new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(), - new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(), + new \Symfony\Component\Mime\FileinfoMimeTypeGuesser(), + new \Symfony\Component\Mime\FileBinaryMimeTypeGuesser(), new \phpbb\mimetype\extension_guesser, new \phpbb\mimetype\content_guesser, ); // Check if any guesser except the extension_guesser is available - $this->fileinfo_supported = $guessers[0]->isSupported() | $guessers[1]->isSupported() | $guessers[3]->is_supported(); + $this->fileinfo_supported = $guessers[0]->isGuesserSupported() | $guessers[1]->isGuesserSupported() | $guessers[3]->is_supported(); // Also create a guesser that emulates not having fileinfo available $this->guesser_no_fileinfo = new \phpbb\mimetype\guesser(array($guessers[2])); @@ -175,7 +175,11 @@ class guesser_test extends \phpbb_test_case // Cover possible LogicExceptions foreach ($guessers as $cur_guesser) { - $supported += $cur_guesser->is_supported(); + $is_supported = (method_exists($cur_guesser, 'is_supported')) ? 'is_supported' : ''; + $is_supported = (method_exists($cur_guesser, 'isSupported')) ? 'isSupported' : $is_supported; + $is_supported = (method_exists($cur_guesser, 'isGuesserSupported')) ? 'isGuesserSupported' : $is_supported; + + $supported += $cur_guesser->$is_supported(); } if (!$supported) @@ -194,9 +198,9 @@ class guesser_test extends \phpbb_test_case public function test_sort_priority() { $guessers = array( - 'FileinfoMimeTypeGuesser' => new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser, + 'FileinfoMimeTypeGuesser' => new \Symfony\Component\Mime\FileinfoMimeTypeGuesser, 'extension_guesser' => new \phpbb\mimetype\extension_guesser, - 'FileBinaryMimeTypeGuesser' => new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser, + 'FileBinaryMimeTypeGuesser' => new \Symfony\Component\Mime\FileBinaryMimeTypeGuesser, 'content_guesser' => new \phpbb\mimetype\content_guesser, ); $guessers['content_guesser']->set_priority(5); diff --git a/tests/mock/container_builder.php b/tests/mock/container_builder.php index 31513d0f31..22241528d3 100644 --- a/tests/mock/container_builder.php +++ b/tests/mock/container_builder.php @@ -195,7 +195,7 @@ class phpbb_mock_container_builder implements ContainerInterface { } - public function isFrozen() + public function isCompiled() { return false; } diff --git a/tests/notification/fixtures/services_notification.yml b/tests/notification/fixtures/services_notification.yml index 470768d986..3d45280ef0 100644 --- a/tests/notification/fixtures/services_notification.yml +++ b/tests/notification/fixtures/services_notification.yml @@ -2,6 +2,7 @@ imports: - { resource: ../../../phpBB/config/default/container/services_notification.yml } services: + _defaults: { public: true } notification_manager: synthetic: true diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 97ff1f62cc..a441eaa3b6 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -1017,12 +1017,12 @@ class phpbb_functional_test_case extends phpbb_test_case */ static public function assert_response_status_code($status_code = 200) { - if ($status_code != self::$client->getResponse()->getStatus() && - preg_match('/^5[0-9]{2}/', self::$client->getResponse()->getStatus())) + if ($status_code != self::$client->getResponse()->getStatusCode() && + preg_match('/^5[0-9]{2}/', self::$client->getResponse()->getStatusCode())) { self::fail("Encountered unexpected server error:\n" . self::$client->getResponse()->getContent()); } - self::assertEquals($status_code, self::$client->getResponse()->getStatus(), 'HTTP status code does not match'); + self::assertEquals($status_code, self::$client->getResponse()->getStatusCode(), 'HTTP status code does not match'); } public function assert_filter($crawler, $expr, $msg = null) diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index d20d8bdf82..5a93d65206 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -455,7 +455,7 @@ class phpbb_test_case_helpers $cache_key_renderer = $prefix . '_renderer'; $container->set('cache.driver', $cache); - if (!$container->isFrozen()) + if (!$container->isCompiled()) { $container->setParameter('cache.dir', $cache_dir); } diff --git a/tests/upload/filespec_test.php b/tests/upload/filespec_test.php index 9b01eb73fd..c501788829 100644 --- a/tests/upload/filespec_test.php +++ b/tests/upload/filespec_test.php @@ -66,8 +66,8 @@ class phpbb_filespec_test extends phpbb_test_case } $guessers = array( - new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(), - new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(), + new \Symfony\Component\Mime\FileinfoMimeTypeGuesser(), + new \Symfony\Component\Mime\FileBinaryMimeTypeGuesser(), new \phpbb\mimetype\content_guesser(), new \phpbb\mimetype\extension_guesser(), ); diff --git a/tests/upload/fileupload_test.php b/tests/upload/fileupload_test.php index f72187167f..2cedb79604 100644 --- a/tests/upload/fileupload_test.php +++ b/tests/upload/fileupload_test.php @@ -59,8 +59,8 @@ class phpbb_fileupload_test extends phpbb_test_case $this->filesystem = new \phpbb\filesystem\filesystem(); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); $guessers = array( - new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(), - new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(), + new \Symfony\Component\Mime\FileinfoMimeTypeGuesser(), + new \Symfony\Component\Mime\FileBinaryMimeTypeGuesser(), new \phpbb\mimetype\content_guesser(), new \phpbb\mimetype\extension_guesser(), ); diff --git a/travis/setup-phpbb.sh b/travis/setup-phpbb.sh index 208b715dfe..20d8ae7d29 100755 --- a/travis/setup-phpbb.sh +++ b/travis/setup-phpbb.sh @@ -46,7 +46,6 @@ cd phpBB php ../composer.phar install --dev --no-interaction if [[ "$TRAVIS_PHP_VERSION" =~ ^nightly$ || "$TRAVIS_PHP_VERSION" =~ ^8 ]] then - php ../composer.phar remove phpunit/dbunit --dev --update-with-dependencies \ - && php ../composer.phar require symfony/yaml:~4.4 misantron/dbunit:~5.0 phpunit/phpunit:^9.3 --dev --update-with-all-dependencies --ignore-platform-reqs + php ../composer.phar require symfony/filesystem:5.2.x-dev phpunit/phpunit:^9.3 --update-with-all-dependencies --ignore-platform-reqs --no-interaction fi cd ..