Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array to string conversion when using regex #364

Open
devkinetic opened this issue Jun 24, 2021 · 0 comments
Open

Array to string conversion when using regex #364

devkinetic opened this issue Jun 24, 2021 · 0 comments

Comments

@devkinetic
Copy link

When I check off regex with the tool, I get the ajax error described in the readme. I looked at the XHR response and saw an error where $this->search is used as a string when its an array. When regex is not checked off, $this->search is a string. I was able to fix searching crudely by modifying line 234 of index.php from:

-$this->search = '/' . $this->search . '/' . $mods;
+$this->search = '/' . $this->search[0] . '/' . $mods;

I also ran into the same but different error when replacing and had to use $replace[0] on srdb.class.php:

public function str_replace( $search, $replace, $string, &$count = 0 ) {
        if ( $this->regex ) {
            return preg_replace( $search, $replace[0], $string, - 1, $count );
        } elseif ( function_exists( 'mb_split' ) ) {
            return self::mb_str_replace( $search, $replace[0], $string, $count );
        } else {
            return str_replace( $search, $replace[0], $string, $count );
        }
    }

I highly doubt this is the actual fix, but it shows that the POST is different for a regex, and is broken on the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant