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: 127.0.0.1, server: site.local, request: “GET /wp-admin/admin.php?page=aiowpsec_filesystem HTTP/2.0”, upstream: “http://127.0.0.1:10004/wp-admin/admin.php?page=aiowpsec_filesystem”, 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: 127.0.0.1, server: site.local, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:10010/”, 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.