View Issue Details

IDProjectCategoryView StatusLast Update
0034468mantisbtcode cleanuppublic2024-07-12 03:11
Reporterdregad Assigned Todregad  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Target Version2.27.0Fixed in Version2.27.0 
Summary0034468: Refactoring and cleaning up includes
Description

Following up on 0033906, I noticed a lot of places where we do dirname( __FILE__ ). Since PHP 5.3, the magic constant __DIR__ is available to get the same results and should used instead.

While reviewing and replacing those occurrences, I noticed a number of places where we use DIRECTORY_SEPARATOR in require/include statements, which is not necessary in this context and should be replaced by /.

Include file references should be standardized to always use dirname( __DIR__ ), leveraging the 2nd parameter to avoid ../ constructs to go back up the directory tree.

TagsNo tags attached.

Relationships

related to 0033906 closeddregad Failed opening core.php in timeline_inc.php on PHP 8.2 / IIS 

Activities

dregad

dregad

2024-06-16 08:47

developer   ~0068973

PR https://github.com/mantisbt/mantisbt/pull/2011

atrol

atrol

2024-07-10 17:27

developer   ~0069033

Last edited: 2024-07-10 17:29

Got INTERNAL APPLICATION ERROR when adding or editing versions.
To fix the regression opened PR https://github.com/mantisbt/mantisbt/pull/2013

atrol

atrol

2024-07-11 16:52

developer   ~0069034

Got INTERNAL APPLICATION ERROR when creating a project.
To fix the regression opened PR https://github.com/mantisbt/mantisbt/pull/2015

Related Changesets

MantisBT: master 36e54774

2024-03-02 10:03

dregad


Details Diff
Replace dirname( __FILE__ ) by __DIR__ (1)

Magic constant __DIR__ is available since PHP 5.3

Fixes 0034468
Affected Issues
0034468
mod - account_manage_columns_page.php Diff File
mod - account_prefs_page.php Diff File
mod - admin/check/check_integrity_inc.php Diff File
mod - admin/install.php Diff File
mod - admin/upgrade_unattended.php Diff File
mod - api/soap/mc_core.php Diff File
mod - api/soap/mc_issue_api.php Diff File
mod - api/soap/mc_issue_attachment_api.php Diff File
mod - api/soap/mc_project_attachment_api.php Diff File
mod - billing_page.php Diff File
mod - bug_change_status_page.php Diff File
mod - bug_relationship_graph.php Diff File
mod - bug_reminder_page.php Diff File
mod - bug_update_page.php Diff File
mod - config_defaults_inc.php Diff File
mod - core.php Diff File
mod - core/commands/ConfigsSetCommand.php Diff File
mod - core/commands/ProjectAddCommand.php Diff File
mod - core/commands/ProjectHierarchyAddCommand.php Diff File
mod - login_page.php Diff File
mod - login_password_page.php Diff File
mod - manage_config_columns_page.php Diff File
mod - manage_user_edit_page.php Diff File
mod - my_view_page.php Diff File
mod - print_all_bug_options_page.php Diff File
mod - print_all_bug_options_reset.php Diff File
mod - print_all_bug_options_update.php Diff File
mod - view.php Diff File
mod - view_all_bug_page.php Diff File

MantisBT: master 91b05338

2024-03-10 10:51

dregad


Details Diff
Replace dirname( __FILE__ ) by __DIR__ (2. Commands)

Some commands require MantisConnect API functions.

Instead of repeating the same dirname() call for each mc_*.php include,
we define the path to SOAP API directory in a variable.

require_once statements defining functions not used in the Command have
been removed.

Fixes 0034468
Affected Issues
0034468
mod - core/commands/ConfigsSetCommand.php Diff File
mod - core/commands/IssueAddCommand.php Diff File
mod - core/commands/IssueViewPageCommand.php Diff File
mod - core/commands/ProjectAddCommand.php Diff File
mod - core/commands/ProjectHierarchyAddCommand.php Diff File
mod - core/commands/ProjectUpdateCommand.php Diff File
mod - core/commands/ProjectUsersAddCommand.php Diff File
mod - core/commands/ProjectUsersGetCommand.php Diff File
mod - core/commands/UserTokenCreateCommand.php Diff File
mod - core/commands/UserTokenDeleteCommand.php Diff File
mod - core/commands/UserUpdateCommand.php Diff File
mod - core/commands/VersionGetCommand.php Diff File

MantisBT: master 132e9d64

2024-06-15 11:25

dregad


Details Diff
Replace dirname( __FILE__ ) by __DIR__ (3)

Fixes 0034468
Affected Issues
0034468
mod - admin/check/index.php Diff File
mod - admin/db_stats.php Diff File
mod - admin/email_queue.php Diff File
mod - admin/index.php Diff File
mod - admin/install.php Diff File
mod - admin/move_attachments.php Diff File
mod - admin/move_attachments_page.php Diff File
mod - admin/system_utils.php Diff File
mod - admin/test_langs.php Diff File
mod - admin/upgrade_unattended.php Diff File
mod - api/rest/restcore/filters_rest.php Diff File
mod - api/soap/mantisconnect.php Diff File
mod - api/soap/mc_api.php Diff File
mod - core/classes/FilterConverter.class.php Diff File
mod - core/logging_api.php Diff File
mod - css/status_config.php Diff File
mod - plugins/MantisCoreFormatting/tests/MarkdownTest.php Diff File
mod - scripts/cronjob.php Diff File
mod - scripts/send_emails.php Diff File
mod - tests/Mantis/Helper/ArrayTransposeTest.php Diff File
mod - tests/Mantis/Helper/GetLinkAttributesTest.php Diff File
mod - tests/Mantis/MantisCoreBase.php Diff File
mod - tests/TestConfig.php Diff File
mod - tests/rest/RestBase.php Diff File
mod - tests/soap/SoapBase.php Diff File
mod - tests/travis_create_api_token.php Diff File

MantisBT: master b5e8bcf8

2024-06-15 11:41

dregad


Details Diff
Replace unnecessary DIRECTORY_SEPARATOR by '/'

Fixes 0034468
Affected Issues
0034468
mod - billing_page.php Diff File
mod - bug_update_page.php Diff File
mod - core.php Diff File
mod - login_password_page.php Diff File
mod - my_view_page.php Diff File
mod - news_rss.php Diff File
mod - view_all_bug_page.php Diff File

MantisBT: master b7fc06f0

2024-07-10 17:20

atrol


Details Diff
Fix INTERNAL APPLICATION ERROR when adding or editing versions

Regression introduced by changes in issue 0034468
Affected Issues
0034468
mod - core/commands/VersionGetCommand.php Diff File

MantisBT: master d10b68f1

2024-07-11 16:48

atrol


Details Diff
Fix INTERNAL APPLICATION ERROR when creating a project

Regression introduced by changes in issue 0034468
Affected Issues
0034468
mod - core/commands/ProjectAddCommand.php Diff File