Skip to content

Conversation

@priethor
Copy link
Contributor

@priethor priethor commented Dec 9, 2025

What

Fix fatal error Call to undefined function wp_generate_password() on specific hosts, as reported in the forums: https://wordpress.org/support/topic/fatal-error-on-plugin-update-to-6-6-0/

Why

Trying to be extra defensive, the JSON Schema validator validated the existence of the schemas during its construction. On hosts where WP uses FTP/SSH filesystem access, the call toWP_Filesystem() to load the schemas triggers code that calls wp_generate_password() - a pluggable function not yet available during early plugin load:

  • The JSON schema validator was calling WP_Filesystem() in the constructor, before WordPress was fully initialized
  • WP_Filesystem is overkill for reading local plugin-bundled JSON files (it was used to satisfy PHPStan requirements).

How

  • Removing the constructor schema validation (schemas will now be fully lazy loaded)
  • Replacing WP_Filesystem with native file_get_contents() for reading local schema files
    • Plus adding PHPCS global exclusion for file_get_contents

Testing Instructions

  1. Update the plugin and verify no fatal error on activation
  2. Use the abilities API and verify the schema validation still works
  3. Run vendor/bin/phpunit --filter "Test_SCF_JSON_Schema_Validator"

@priethor priethor added this to the 6.7.1 milestone Dec 9, 2025
@priethor priethor requested a review from cbravobernal December 9, 2025 17:20
@priethor priethor self-assigned this Dec 9, 2025
@priethor priethor added the [Type] Bug Something isn't working label Dec 9, 2025
@github-actions
Copy link

github-actions bot commented Dec 9, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props priethor, cbravobernal.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 10.96%. Comparing base (34a448e) to head (f40cd33).
⚠️ Report is 1 commits behind head on trunk.

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk     #275      +/-   ##
============================================
- Coverage     10.98%   10.96%   -0.03%     
+ Complexity     4288     4284       -4     
============================================
  Files           266      266              
  Lines         33159    33139      -20     
============================================
- Hits           3644     3634      -10     
+ Misses        29515    29505      -10     
Flag Coverage Δ
e2e 29.55% <ø> (-0.03%) ⬇️
phpunit 6.06% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Copy link
Contributor

@cbravobernal cbravobernal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cbravobernal cbravobernal merged commit c83b060 into trunk Dec 9, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants