Sage theme giving error about object argument in illuminate\support\helpers.php

What issue or error are you experiencing?

Warning: htmlspecialchars() expects parameter 1 to be string, object given in C:\Users\user1\Local Sites\site1\app\public\wp-content\themes\sitetheme1\vendor\illuminate\support\helpers.php

In the file of helpers.php, my site is having trouble with the htmlspecialchars function being passed an object when it expects a string. Normally this is not an issue on our remote site, so it must be something in LocalWP that is causing this section of code to be passed an object rather than a string that it expects. This is within the sage theme that uses elements of Laravel mixed into a wordpress theme with custom post types. Here is the code that is being passed an object instead of a string that it would normally get on our remote site:

if (! function_exists('e')) {
    function e($value, $doubleEncode = true)
        if ($value instanceof Htmlable) {
            return $value->toHtml();

        return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', $doubleEncode);

So does anyone know why the boilerplate “e” Laravel illuminate function in our Sage theme would be passed an object only in Local WP? This causes our image gallery on the home page to display the previously mentioned error. Here is the link to the sage theme open source code on Github:

What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

Install the sage theme on Local WP, implement an image slider on your home page.

System Details

  • Local Version: 7.1.2+6410

  • Operating System (OS) and OS version:
    Windows 10

Local Logs

Attach your Local Logs here (Help Doc - Retrieving Local’s Log)

2023/08/30 18:50:45 [error] 12864#12876: *5 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client:, server: site.local, request: “GET /wp-admin/admin.php?page=aiowpsec_filesystem HTTP/2.0”, upstream: “”, host: “site.local”, referrer: “https://site.local/wp-admin/admin.php?page=aiowpsec_settings&tab=advanced-settings”
2023/08/30 18:51:42 [crit] 12864#12876: *16 SSL_write() failed (10053: An established connection was aborted by the software in your host machine) while sending to client, client:, server: site.local, request: “GET / HTTP/1.1”, upstream: “”, host: “site.local”, referrer: “https://site.local/”
2023/08/30 19:19:49 [alert] 13232#10816: OpenEvent(“ngx_master_2448”) failed (2: The system cannot find the file specified)

Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Hey @spbos – it’s hard to know exactly what’s going on, but here are a few guesses and some ways to get more info.

For starters, since Local is a development environment, it has verbose error reporting turned on by default so that you can find errors and warnings early before those errors are deployed to the remote server.

That htmlspecialchars() message is technically a warning and not anything too critical. Many production environments suppress warnings so that the site doesn’t look broken.

Despite this being a warning, you’ll still probably want to zero in on why the warning is happening because it’s possible that warnings could lead to larger issues or bugs down the line.

In terms of why $value is an object – that could be due to lots of issues. I’d recommend putting some var_dump()'s in there or doing some step-debugging to figure out what the value actually is.

If you’re curious about learning more about error reporting as well as how to disable those warnings in Local, see this help doc:

Hi @ben.turner thank you for your reply. That would make sense that this error only shows when we run the site in local and the production environment has no mention of this error. I have tried to var_dump and see the actual value being passed to htmlspecialchars() and it is indeed an object when it expects a string, so I suppose the same thing is happening on our production site and we just never noticed it. Thank you for pointing me to the Warnings Docs for local. I will try tinkering with our theme settings some more. I suppose for now, to prevent us from losing any more time on trying to fix this warning, I can just try to suppress the warning in Local as we do in production so I can get back to our other more important tasks.
Thanks again for your support!

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.