Skip to content
Advertisement

Passing the encoding as third parameter is deprecated. Use an explicit zero offset

I just switched to the server from the localhost. It was working all fine until a few minutes ago. When I load the front page, this is the error It keeps showing up.

mb_strrpos(): Passing the encoding as the third parameter is deprecated. Use an explicit zero offset (View:some-blade.blade.php)

Any idea what this error is trying to imply?

Error point directed

root/mainapp/vendor/thunderer/shortcode/src/Processor/Processor.php

In line 138,139,140:

 if($handler) {
        return call_user_func_array($handler, array($processed));
    }

    $state = $parsed->getText();
 *138*   $length = mb_strlen($processed->getTextContent(), 'utf-8');
 **139**  $offset = mb_strrpos($state, $processed->getTextContent(), 'utf-8');

 *140* return mb_substr($state, 0, $offset, 'utf-8').$processed->getContent().mb_substr($state, $offset + $length, mb_strlen($state, 'utf-8'), 'utf-8');
}

Advertisement

Answer

You’re using PHP 7.4, which has changed the number of arguments in mb_strrpos(). You need to pass the encoding as the 4th parameter now.

See Migration Guide for 7.4

Passing the encoding as 3rd parameter to mb_strrpos() is deprecated. Instead pass a 0 offset, and encoding as 4th parameter.


Sidenote: It looks like this was not added to the changelog of the mb_strrpos documentation. So I have updated the changelog list in the documentation here.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement