Skip to content

Conversation

smg6511
Copy link
Collaborator

@smg6511 smg6511 commented Aug 2, 2025

What does it do?

Replaces NULL $path with empty string.

Why is it needed?

The str_replace fn no longer quietly allows a null value to be passed to its subject param. Deprecation notices show in php logs when null is passed in php 8.1+.

How to test

  1. Change a namespace's core or assets path to NULL via sql query.
  2. Observe the php logs after clearing modx's cache (before loading this PR); you should see the deprecation notice(s).
  3. Load the PR and clear cache again. There should be no deprecation notices (of the type seen in step 2).

Future Consideration

This could also be avoided by altering the path and assets_path columns in the namespaces table to be not null with default of empty string.

Related issue(s)/PR(s)

No related issue.

Makes translatePath null-safe
@smg6511 smg6511 requested review from opengeek and Mark-H as code owners August 2, 2025 04:31
Alternatively, just return the empty string instead of allowing str_replace to run
Copy link

codecov bot commented Aug 2, 2025

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.55%. Comparing base (b1a02c3) to head (93c3847).
⚠️ Report is 50 commits behind head on 3.x.

Files with missing lines Patch % Lines
core/src/Revolution/modNamespace.php 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                3.x   #16763      +/-   ##
============================================
+ Coverage     21.53%   21.55%   +0.01%     
- Complexity    10734    10742       +8     
============================================
  Files           565      565              
  Lines         32540    32573      +33     
============================================
+ Hits           7007     7020      +13     
- Misses        25533    25553      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Code formatting fixes
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.

1 participant