Forum

Thread tagged as: Question, Error, Configuration

Warning: stripslashes()

Hey hey,

getting this weird error on my search results page. googled it and don't have a clue what it means still.

Warning: stripslashes() expects parameter 1 to be string, array given in /home/kieranfi/public_html/perch/core/apps/content/runtime.php on line 116

See the live example of the error:

https://kieranhunter.co.uk/search.php?s=error

Kieran Hunter

Kieran Hunter 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can I see your diagnostics?

Hello Drew

I didn't know about this, I need to update Perch. I will try that and see if it fixes it this afternoon, it's only very slightly out of date.

Here is my report for now. Hows does it look?

Perch: 2.8.2, PHP: 5.4.37, MySQL: mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $, with PDO
Server OS: Linux, litespeed
Installed apps: content (2.8.2), assets (2.8.2), categories (2.8.2), perch_blog (4.6), perch_forms (1.8.2)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/kieranfi/public_html/perch
PERCH_CORE: /home/kieranfi/public_html/perch/core
PERCH_RESFILEPATH: /home/kieranfi/public_html/perch/resources
Image manipulation: GD
PHP limits: Max upload 256M, Max POST 256M, Memory: 128M, Total max file upload: 128M
Resource folder writeable: Yes
HTTP_HOST: kieranhunter.co.uk
DOCUMENT_ROOT: /home/kieranfi/public_html
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show me how you're calling perch_content_search() ?

This is in my search.php

The search works fine btw, it's just that random error.

            <?php 

            $query = perch_get('s');

            perch_content_search(array(
                'template' => 'search_title.html'
            ));

            perch_content_search($query);
        ?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to check the documentation https://docs.grabaperch.com/docs/page-functions/

Try this instead:

<?php 
    $query = perch_get('s');
    perch_content_search($query, array(
        'template' => 'search_title.html'
    ));
?>

This removes the error and my search results.

https://kieranhunter.co.uk/search.php?s=chicken

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you checked your search_title.html template?

I changed that file to the 'search-result.html' template, and it works!

How was this even working before, Im so confused.

Thank you! :)

Drew McLellan

Drew McLellan 2638 points
Perch Support

You were searching twice - once with invalid arguments (hence the error) and once with the defaults (hence the results).