Skip to content

Create a centralized service for a path to the main plugin file (4970) #3505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Narek13
Copy link
Collaborator

@Narek13 Narek13 commented Jul 4, 2025

Issue Description

The codebase has multiple service files that use realpath(__FILE__) without proper error handling, which can cause fatal TypeError exceptions when the file path cannot be resolved. This issue was identified in production where realpath() returned false, causing dirname() to receive a boolean instead of a string.

PR Description

This PR adds a centralized service for a path to the main plugin file with a fallback to use the __FILE__ when realpath() fails

@Narek13 Narek13 changed the title Create a centralized service for a path to the main plugin file. Create a centralized service for a path to the main plugin file PCP-4970 Jul 4, 2025
@Narek13 Narek13 changed the title Create a centralized service for a path to the main plugin file PCP-4970 Create a centralized service for a path to the main plugin file (4970) Jul 4, 2025
@Narek13 Narek13 self-assigned this Jul 4, 2025
@Narek13 Narek13 requested a review from AlexP11223 July 4, 2025 15:31
@InpsydeNiklas InpsydeNiklas merged commit 4a985fc into trunk Aug 4, 2025
11 checks passed
@InpsydeNiklas InpsydeNiklas deleted the PCP-4970-add-defensive-code-for-realpath-failures-in-module-service-files branch August 4, 2025 17:42
@InpsydeNiklas InpsydeNiklas added this to the 3.1.0 milestone Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants