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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The translation template is now generated locally with `composer make-pot` and committed with each change; the Update Translation File workflow was removed
- The translation template names the GitHub issue tracker as its bug report address, in place of a WordPress.org support forum the plugin does not have, and its source references were refreshed
- The code uses PHP 8 forms: short arrays, constructor property promotion, `readonly` classes and properties for the optimization and admin classes, and a null-coalescing assignment. Behavior is unchanged
- The plugin coordinator refuses to be unserialized from `__unserialize()` in place of `__wakeup()`, which PHP 8.5 deprecates. Behavior is unchanged
- A new Rector job 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. PHPCS requires the short array syntax
- ESLint applies modern-JavaScript rules, and ESLint and Stylelint fail on a browser feature that WordPress's supported browsers lack. `package.json` overrides `smol-toml`, `katex`, and `re2js` (used by the Markdown linter) for their advisories

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
],
"minimum-stability": "stable",
"require": {
"php": ">=8.3"
"php": ">=8.3",
"ext-filter": "*"
},
"require-dev": {
"phpunit/phpunit": "^11.5 || ^12.5 || ^13.4",
Expand Down
5 changes: 3 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion includes/class-optimizations-ace-mc.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,16 @@ private function __clone() {}
/**
* Prevent unserializing.
*
* PHP calls __unserialize() for every unserialize() of this class; it
* replaces __wakeup(), which PHP 8.5 deprecates.
*
* @since 1.0.7
* @param array<array-key, mixed> $data The serialized properties, never used.
* @throws LogicException Always; the coordinator must not be recreated from serialized data.
*/
public function __wakeup(): void {
public function __unserialize( array $data ): void {
unset( $data );

throw new LogicException( esc_html__( 'Unserializing is not allowed.', 'optimizations-ace-mc' ) );
}

Expand Down
4 changes: 2 additions & 2 deletions languages/optimizations-ace-mc.pot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2026-11-14T08:51:05+00:00\n"
"POT-Creation-Date: 2026-11-24T06:38:55+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.12.0\n"
"X-Domain: optimizations-ace-mc\n"
Expand Down Expand Up @@ -164,6 +164,6 @@ msgstr ""
msgid "Certifications:"
msgstr ""

#: includes/class-optimizations-ace-mc.php:70
#: includes/class-optimizations-ace-mc.php:76
msgid "Unserializing is not allowed."
msgstr ""
4 changes: 2 additions & 2 deletions tests/unit/PluginWiringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function test_a_second_coordinator_cannot_be_made(): void {
$this->assertTrue( $class->isFinal() );

$this->expectException( LogicException::class );
Optimizations_Ace_Mc::instance()->__wakeup();
Optimizations_Ace_Mc::instance()->__unserialize( [] );
}

/**
Expand All @@ -120,7 +120,7 @@ public function test_unserialize_refusal_message_is_escaped(): void {
$this->use_translation_with_markup();

try {
Optimizations_Ace_Mc::instance()->__wakeup();
Optimizations_Ace_Mc::instance()->__unserialize( [] );
$this->fail( 'Unserializing must be refused.' );
} catch ( LogicException $exception ) {
$this->assert_no_raw_markup( $exception->getMessage() );
Expand Down
Loading