Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/wp-compatibility-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,9 @@ jobs:
# The WordPress test library still calls PHPUnit APIs removed in PHPUnit 10+.
# Keep this generated integration-test job on PHPUnit 9.6 while the rest
# of the project can continue using newer Composer-resolved QA tooling.
# This job does not run Psalm, and Psalm 7.4+ requires psalm/plugin-phpunit, whose
# 1.x releases conflict with PHPUnit below 11: remove Psalm first.
composer remove --dev vimeo/psalm --no-interaction --no-progress
if [ "${{ matrix.dependency-versions }}" = "lowest" ]; then
composer require --dev phpunit/phpunit:"^9.6" yoast/phpunit-polyfills:"^4.0" --with-all-dependencies --prefer-lowest --no-progress
else
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ see the current README and Security Policy for supported behavior and guidance.
- **Rector**: A new Rector job runs `rector process --dry-run` with `rector.php` and fails when PHP 8.3 or Rector's dead-code, code-quality, type-declaration, or early-return rules would change the code. `rector.php` skips the rules that conflict with WordPress, each with its reason; `composer rector` runs the same check, and `composer check-all` includes it.
- **Modern JavaScript and Browser Support**: ESLint also applies `eslint-plugin-unicorn` rules for modern built-ins and patterns, and `eslint-plugin-compat` fails on a browser API that WordPress's supported browsers lack. Stylelint does the same for CSS with `stylelint-no-unsupported-browser-features`. Both read the browser list from `@wordpress/browserslist-config`.
- **Arrays**: PHPCS now requires the short array syntax, the form all EngineScript plugins use.
- **Psalm 7**: Static analysis runs on Psalm 7. It found six `(string)` casts of request values that `is_string()` had already checked, which are removed. The included files' direct-access guards carry a Psalm note, because Psalm 7.5 reads them as already decided by the main file's own check; they still stop a direct request. Psalm no longer checks the comments in the WordPress stubs, which Psalm 7 rejects in places. Behavior is unchanged.
- **npm Advisories**: `package.json` overrides `smol-toml`, `katex`, and `re2js` (used by the Markdown linter) with releases that fix their advisories.
- **Workflow Names**: The JavaScript test job is now "JavaScript Tests (Node 24)", the name it has in the other EngineScript plugins. Three issue templates that no workflow used were removed.

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"dealerdirect/phpcodesniffer-composer-installer": "^1.2",
"friendsofphp/php-cs-fixer": "^3.95",
"phpmd/phpmd": "^3.0",
"vimeo/psalm": "^6.16",
"vimeo/psalm": "^7.0",
"php-stubs/wordpress-stubs": "^7.1.2",
"szepeviktor/phpstan-wordpress": "^2.0",
"phpstan/phpstan": "^2.3.1",
Expand Down
488 changes: 405 additions & 83 deletions composer.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions includes/admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
*/

// Prevent direct execution of this component.
/**
* Psalm 7.5 reads this guard as already decided by the main plugin file's own check;
* it still stops a direct request to this file.
*
* @psalm-suppress RedundantCondition, ParadoxicalCondition
*/
if ( ! defined( 'ABSPATH' ) ) {
return;
}
Expand Down
6 changes: 6 additions & 0 deletions includes/archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
*/

// Prevent direct execution of this component.
/**
* Psalm 7.5 reads this guard as already decided by the main plugin file's own check;
* it still stops a direct request to this file.
*
* @psalm-suppress RedundantCondition, ParadoxicalCondition
*/
if ( ! defined( 'ABSPATH' ) ) {
return;
}
Expand Down
15 changes: 9 additions & 6 deletions includes/cleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
*/

// Prevent direct execution of this component.
/**
* Psalm 7.5 reads this guard as already decided by the main plugin file's own check;
* it still stops a direct request to this file.
*
* @psalm-suppress RedundantCondition, ParadoxicalCondition
*/
if ( ! defined( 'ABSPATH' ) ) {
return;
}
Expand Down Expand Up @@ -294,13 +300,10 @@ function esse_uninstall_plugin(): void {
)
);

foreach ( $site_ids as $site_id ) {
if ( ! is_numeric( $site_id ) ) {
continue;
}

// Only numeric IDs, as integers.
foreach ( array_map( intval( ... ), array_filter( $site_ids, is_numeric( ... ) ) ) as $site_id ) {
// phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.switch_to_blog_switch_to_blog -- Only the site's options and cron entries are removed; no code of that site has to load.
switch_to_blog( (int) $site_id );
switch_to_blog( $site_id );
delete_option( 'sse_error_logs' );
foreach ( esse_get_scheduled_hook_names() as $hook ) {
wp_unschedule_hook( $hook );
Expand Down
14 changes: 10 additions & 4 deletions includes/download.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
*/

// Prevent direct execution of this component.
/**
* Psalm 7.5 reads this guard as already decided by the main plugin file's own check;
* it still stops a direct request to this file.
*
* @psalm-suppress RedundantCondition, ParadoxicalCondition
*/
if ( ! defined( 'ABSPATH' ) ) {
return;
}
Expand All @@ -17,8 +23,8 @@
*/
function esse_handle_secure_download(): void {
// The values are only unslashed and cleaned here. The anchored name patterns and the resolved-path check below are the control.
$filename = isset( $_GET['file'] ) && is_string( $_GET['file'] ) ? sanitize_text_field( (string) wp_unslash( $_GET['file'] ) ) : '';
$export_dir_name = isset( $_GET['export_dir'] ) && is_string( $_GET['export_dir'] ) ? sanitize_text_field( (string) wp_unslash( $_GET['export_dir'] ) ) : '';
$filename = isset( $_GET['file'] ) && is_string( $_GET['file'] ) ? sanitize_text_field( wp_unslash( $_GET['file'] ) ) : '';
$export_dir_name = isset( $_GET['export_dir'] ) && is_string( $_GET['export_dir'] ) ? sanitize_text_field( wp_unslash( $_GET['export_dir'] ) ) : '';
if ( '' === $filename || '' === $export_dir_name ) {
esse_wp_die( __( 'Invalid download request.', 'enginescript-site-exporter' ), 400 );
}
Expand Down Expand Up @@ -54,8 +60,8 @@ function esse_handle_secure_download(): void {
*/
function esse_handle_export_deletion(): void {
// The values are only unslashed and cleaned here. The anchored name patterns and the resolved-path check below are the control.
$filename = isset( $_POST['file'] ) && is_string( $_POST['file'] ) ? sanitize_text_field( (string) wp_unslash( $_POST['file'] ) ) : '';
$export_dir_name = isset( $_POST['export_dir'] ) && is_string( $_POST['export_dir'] ) ? sanitize_text_field( (string) wp_unslash( $_POST['export_dir'] ) ) : '';
$filename = isset( $_POST['file'] ) && is_string( $_POST['file'] ) ? sanitize_text_field( wp_unslash( $_POST['file'] ) ) : '';
$export_dir_name = isset( $_POST['export_dir'] ) && is_string( $_POST['export_dir'] ) ? sanitize_text_field( wp_unslash( $_POST['export_dir'] ) ) : '';
if ( '' === $filename || '' === $export_dir_name ) {
esse_wp_die( __( 'Invalid deletion request.', 'enginescript-site-exporter' ), 400 );
}
Expand Down
10 changes: 8 additions & 2 deletions includes/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
*/

// Prevent direct execution of this component.
/**
* Psalm 7.5 reads this guard as already decided by the main plugin file's own check;
* it still stops a direct request to this file.
*
* @psalm-suppress RedundantCondition, ParadoxicalCondition
*/
if ( ! defined( 'ABSPATH' ) ) {
return;
}
Expand Down Expand Up @@ -658,7 +664,7 @@ function esse_validate_exported_database_file( array $database_file ): true|WP_E
* @return int|false Selected per-file size limit in bytes when the request is valid, false otherwise.
*/
function esse_validate_export_request(): int|false {
$post_action = isset( $_POST['action'] ) && is_string( $_POST['action'] ) ? sanitize_key( (string) wp_unslash( $_POST['action'] ) ) : '';
$post_action = isset( $_POST['action'] ) && is_string( $_POST['action'] ) ? sanitize_key( wp_unslash( $_POST['action'] ) ) : '';
if ( 'sse_export_site' !== $post_action ) {
return false;
}
Expand All @@ -670,7 +676,7 @@ function esse_validate_export_request(): int|false {
}

// Accept only a size that the form offers; anything else means no limit.
$requested_size = isset( $_POST['sse_max_file_size'] ) && is_string( $_POST['sse_max_file_size'] ) ? sanitize_text_field( (string) wp_unslash( $_POST['sse_max_file_size'] ) ) : '';
$requested_size = isset( $_POST['sse_max_file_size'] ) && is_string( $_POST['sse_max_file_size'] ) ? sanitize_text_field( wp_unslash( $_POST['sse_max_file_size'] ) ) : '';
foreach ( array_keys( esse_get_export_file_size_options() ) as $offered_size ) {
if ( (string) $offered_size === $requested_size ) {
return $offered_size;
Expand Down
6 changes: 6 additions & 0 deletions includes/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
*/

// Prevent direct execution of this component.
/**
* Psalm 7.5 reads this guard as already decided by the main plugin file's own check;
* it still stops a direct request to this file.
*
* @psalm-suppress RedundantCondition, ParadoxicalCondition
*/
if ( ! defined( 'ABSPATH' ) ) {
return;
}
Expand Down
6 changes: 6 additions & 0 deletions includes/lease.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
*/

// Prevent direct execution of this component.
/**
* Psalm 7.5 reads this guard as already decided by the main plugin file's own check;
* it still stops a direct request to this file.
*
* @psalm-suppress RedundantCondition, ParadoxicalCondition
*/
if ( ! defined( 'ABSPATH' ) ) {
return;
}
Expand Down
6 changes: 6 additions & 0 deletions includes/process.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
*/

// Prevent direct execution of this component.
/**
* Psalm 7.5 reads this guard as already decided by the main plugin file's own check;
* it still stops a direct request to this file.
*
* @psalm-suppress RedundantCondition, ParadoxicalCondition
*/
if ( ! defined( 'ABSPATH' ) ) {
return;
}
Expand Down
6 changes: 6 additions & 0 deletions includes/security.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
*/

// Prevent direct execution of this component.
/**
* Psalm 7.5 reads this guard as already decided by the main plugin file's own check;
* it still stops a direct request to this file.
*
* @psalm-suppress RedundantCondition, ParadoxicalCondition
*/
if ( ! defined( 'ABSPATH' ) ) {
return;
}
Expand Down
6 changes: 6 additions & 0 deletions includes/tar.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
*/

// Prevent direct execution of this component.
/**
* Psalm 7.5 reads this guard as already decided by the main plugin file's own check;
* it still stops a direct request to this file.
*
* @psalm-suppress RedundantCondition, ParadoxicalCondition
*/
if ( ! defined( 'ABSPATH' ) ) {
return;
}
Expand Down
Loading
Loading