InvoicePlane 1.5.9 router.php error


#1

Hi
This error is showing on all pages.

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: MX/Router.php

Line Number: 224

Backtrace:

File: C:\xampp\htdocs\InvoicePlane\application\third_party\MX\Router.php
Line: 224
Function: strpos

File: C:\xampp\htdocs\InvoicePlane\application\third_party\MX\Router.php
Line: 71
Function: set_class

File: C:\xampp\htdocs\InvoicePlane\index.php
Line: 325
Function: require_once

This is code which seems to have some issue

public function set_class($class)
{
    $suffix = $this->config->item('controller_suffix');
    if (strpos($class, $suffix) === false) {
        $class .= $suffix;
    }
    parent::set_class($class);
}

Have U gus have any ideas? :slight_smile: THX in advantage U R Great!
PHP.7.3 Windows


#2

Some solution coud be quote out
//if (strpos($class, $suffix) === false) {
and add this
if (strncmp($class, $suffix, strlen($suffix)) === 0) {

But I don’t know what else and if it gonna do some bugs.
Error message seems to dissapear.


#3

Hello @Mario

An easy solution can also to check if $suffix exists by doing this

if ($suffix && strpos($class, $suffix) === false) {

#4

Guess this issue is related to this one:

Maybe the solution over there also fits here.
If so we have to evaluate which is better. And then include the better one to the core to fix PHP 7.3 Support