Skip to content

Conversation

@i-just
Copy link
Contributor

@i-just i-just commented Jan 8, 2026

Description

Steps to reproduce:

  • clean 4.16.19 or 5.8.21 install
  • create a custom module or plugin with a console controller and a service
  • in the console controller, add a method like so:
    public function actionTest(): int
    {
        $t1 = "test \200 me";
        Plugin::getInstance()->myService->test($t1);
        return ExitCode::OK;
    }
    
  • in the service, add the following method:
    public function test(string $param1) {
        Craft::$app->getDeprecator()->log(__METHOD__, 'some message');
    }
    
  • hit that console controller method, e.g. ddev craft test-plugin/default/test
  • observe the error

It can also be achieved if $t1 is set to e.g. random_string(5).

Technically, this can also be reproduced by calling Json::encode() on a string that contains non-UTF8 chars.

Fix:
Running the stack trace string-type argument values via mb_convert_encoding() ensures the stack trace can be properly saved in the database.

Related issues

#18218

@i-just i-just requested a review from brandonkelly January 8, 2026 15:46
[ci skip]
@brandonkelly brandonkelly merged commit bae59fe into 4.x Jan 8, 2026
2 checks passed
@brandonkelly brandonkelly deleted the bugfix/18218-deprecator-and-arg-encoding branch January 8, 2026 16:32
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