[ticket/17672] Fix php 8.2 and symfony 7.4 deprecations#6973
Open
rubencm wants to merge 11 commits into
Open
Conversation
f6e9d13 to
02517b7
Compare
utf8_encode() was deprecated in PHP 8.2 and will be removed in PHP 9.0. Replace all 6 calls in recode_basic.php with mb_convert_encoding(). Affected functions: iso_8859_1(), iso_8859_8(), iso_8859_9(), iso_8859_15(), cp1252(), cp1254() PHPBB-17672
HttpKernel\DependencyInjection\Extension was marked @internal since Symfony 7.1. Replace with DependencyInjection\Extension\Extension. Add : void return type to load() overrides to match ExtensionInterface. PHPBB-17672
getArguments() was removed from ControllerResolverInterface in Symfony 5.0. Add argument_resolver implementing ArgumentResolverInterface with phpBB type-casting security logic and register it in services_http.yml. PHPBB-17672
Add explicit void return type to phpBB CompilerPassInterface implementations: collection_pass and markpublic_pass. PHPBB-17672
Update tests in controller_test.php to expect TypeError instead of ReflectionException when invalid callable arguments are passed to the typehinted getArguments() method. PHPBB-17672
Run phpcbf on phpBB/phpbb to auto-fix code layout and style violations, including uppercase NULL constants and trailing empty lines. PHPBB-17672
Update the expected exception message in extension_controller_test to match the format produced by phpBB's custom argument_resolver. PHPBB-17672
PHPBB-17672
PHPBB-17672
There was a problem hiding this comment.
Pull request overview
This PR updates phpBB to avoid deprecations and behavior changes introduced by PHP 8.2 and Symfony 7.4, primarily by adjusting test helpers/mocks/reflection usage and aligning core integrations (HttpKernel argument resolution, Console command registration, config tree building) with Symfony 7.4 APIs.
Changes:
- Introduces a dedicated
phpbb\controller\argument_resolverand wires it into Symfony’sHttpKernel, removing argument resolution from the controller resolver. - Updates tests and console-related wiring to match Symfony 7.4 expectations (e.g.,
Application::addCommand(), updated controller error messages, removing deprecated reflectionsetAccessible()calls). - Replaces deprecated PHP functions/usages (e.g.,
utf8_encode) and fixes/modernizes various docblocks and type signatures.
Reviewed changes
Copilot reviewed 60 out of 60 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/path_helper/path_helper_test.php | Updates mock method list to reflect current phpbb\symfony_request usage. |
| tests/notification/manager_mark_by_id_test.php | Removes deprecated reflection setAccessible() usage in test. |
| tests/migrator/revert_data_merge_test.php | Removes deprecated reflection setAccessible() usage in test. |
| tests/functional/fixtures/ext/foo/foo/event/template_event_order.php | Adds return type to getSubscribedEvents() for Symfony subscriber signature compatibility. |
| tests/functional/fixtures/ext/foo/foo/event/template_event_order_lower.php | Adds return type to getSubscribedEvents() for Symfony subscriber signature compatibility. |
| tests/functional/fixtures/ext/foo/bar/event/user_setup.php | Adds return type to getSubscribedEvents() for Symfony subscriber signature compatibility. |
| tests/functional/fixtures/ext/foo/bar/event/template_event_order.php | Adds return type to getSubscribedEvents() for Symfony subscriber signature compatibility. |
| tests/functional/fixtures/ext/foo/bar/event/template_event_order_higher.php | Adds return type to getSubscribedEvents() for Symfony subscriber signature compatibility. |
| tests/functional/fixtures/ext/foo/bar/event/permission.php | Adds return type to getSubscribedEvents() for Symfony subscriber signature compatibility. |
| tests/functional/extension_controller_test.php | Updates expected exception text emitted by controller argument resolution. |
| tests/download/download_allowed_test.php | Removes deprecated reflection setAccessible() usage in test. |
| tests/controller/controller_test.php | Switches controller argument resolution tests to use the new argument_resolver and updates expected failures. |
| tests/console/user/reclean_test.php | Uses Application::addCommand() per Symfony Console 7.4 API changes. |
| tests/console/user/delete_test.php | Uses Application::addCommand() per Symfony Console 7.4 API changes. |
| tests/console/user/delete_ids_test.php | Uses Application::addCommand() per Symfony Console 7.4 API changes. |
| tests/console/user/add_test.php | Uses Application::addCommand() per Symfony Console 7.4 API changes. |
| tests/console/user/activate_test.php | Uses Application::addCommand() per Symfony Console 7.4 API changes. |
| tests/console/update/check_test.php | Uses Application::addCommand() per Symfony Console 7.4 API changes. |
| tests/console/thumbnail_test.php | Uses Application::addCommand() for thumbnail console command registration. |
| tests/console/searchindex/list_all_test.php | Uses Application::addCommand() per Symfony Console 7.4 API changes. |
| tests/console/searchindex/delete_test.php | Uses Application::addCommand() per Symfony Console 7.4 API changes. |
| tests/console/searchindex/create_test.php | Uses Application::addCommand() per Symfony Console 7.4 API changes. |
| tests/console/cron/run_test.php | Uses Application::addCommand() per Symfony Console 7.4 API changes. |
| tests/console/cron/cron_list_test.php | Uses Application::addCommand() per Symfony Console 7.4 API changes. |
| tests/console/config/config_test.php | Uses Application::addCommand() per Symfony Console 7.4 API changes. |
| tests/console/cache/purge_test.php | Uses Application::addCommand() per Symfony Console 7.4 API changes. |
| tests/auth/provider_oauth_token_storage_test.php | Removes deprecated reflection setAccessible() usage in test. |
| phpBB/phpbb/version_helper.php | Fixes sorting callback to use three-way compare instead of boolean comparison. |
| phpBB/phpbb/template/twig/node/includenode.php | Docblock cleanup: correct parameter naming/type hinting. |
| phpBB/phpbb/template/twig/node/includeasset.php | Docblock cleanup: correct parameter naming/type hinting. |
| phpBB/phpbb/template/twig/node/event.php | Docblock cleanup: correct parameter naming/type hinting. |
| phpBB/phpbb/template/twig/node/definenode.php | Docblock cleanup: correct parameter naming/type hinting. |
| phpBB/phpbb/template/twig/extension/routing.php | Docblock tag reordering (author tag positioning) for consistency. |
| phpBB/phpbb/passwords/driver/salted_md5.php | Docblock metadata cleanup for the embedded hashing framework header. |
| phpBB/phpbb/install/installer_configuration.php | Removes isRequired() calls where defaults are provided (Symfony Config deprecation alignment). |
| phpBB/phpbb/install/console/command/update/update.php | Adds : void return type to configure() to match Symfony Console signatures. |
| phpBB/phpbb/install/console/command/update/config/validate.php | Adds : void return type to configure() to match Symfony Console signatures. |
| phpBB/phpbb/install/console/command/update/config/show.php | Adds : void return type to configure() to match Symfony Console signatures. |
| phpBB/phpbb/install/console/command/install/install.php | Adds : void return type to configure() to match Symfony Console signatures. |
| phpBB/phpbb/install/console/command/install/config/validate.php | Adds : void return type to configure() to match Symfony Console signatures. |
| phpBB/phpbb/install/console/command/install/config/show.php | Adds : void return type to configure() to match Symfony Console signatures. |
| phpBB/phpbb/extension/di/extension_base.php | Adjusts imports and return typing to avoid Symfony type/deprecation issues. |
| phpBB/phpbb/exception/runtime_exception.php | Replaces \Exception with \Throwable for chaining compatibility and modern PHP typing. |
| phpBB/phpbb/exception/http_exception.php | Replaces \Exception with \Throwable for chaining compatibility and modern PHP typing. |
| phpBB/phpbb/di/pass/markpublic_pass.php | Adds : void return type to compiler pass process() method. |
| phpBB/phpbb/di/pass/collection_pass.php | Adds : void return type to compiler pass process() method. |
| phpBB/phpbb/di/extension/core.php | Adjusts imports and return typing to avoid Symfony type/deprecation issues. |
| phpBB/phpbb/db/tools/doctrine.php | Docblock parameter name fix for clarity and tooling. |
| phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php | Normalizes NULL to null in schema arrays (PHP 8.2 compatibility/style). |
| phpBB/phpbb/db/migration/data/v30x/release_3_0_0.php | Normalizes NULL to null in schema arrays (PHP 8.2 compatibility/style). |
| phpBB/phpbb/db/driver/driver.php | Fixes a switch case label terminator typo for query building. |
| phpBB/phpbb/controller/resolver.php | Removes argument resolution from controller resolver (to be handled by dedicated argument resolver). |
| phpBB/phpbb/controller/argument_resolver.php | New Symfony ArgumentResolverInterface implementation applying phpBB string type-casting for URL attributes. |
| phpBB/phpbb/console/application.php | Uses addCommand() when registering commands from the container. |
| phpBB/phpbb/composer/installer.php | Removes deprecated reflection setAccessible() usage when reading repository URL. |
| phpBB/phpbb/avatar/manager.php | Docblock parameter naming fix for clarity and tooling. |
| phpBB/includes/utf/data/recode_basic.php | Replaces deprecated utf8_encode() with mb_convert_encoding() based conversions. |
| phpBB/includes/diff/diff.php | Docblock @since cleanup. |
| phpBB/includes/acp/acp_permissions.php | Docblock type order correction for property annotation. |
| phpBB/config/default/container/services_http.yml | Wires the new controller argument resolver into the http_kernel service definition. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist:
Tracker ticket:
https://tracker.phpbb.com/browse/PHPBB-17672