I’m getting this error message in the left sidebar in a subpage in my website:
file_exists() expects parameter 1 to be a valid path, string given
It appeared after updating to 2.4.0 and persisted after upgrading to 2.4.1.
In another topic ( Strange new Error Message when editing subpages ) there was a suggestion to rename all the blueprints to remove null bytes from the file names. I tried to do it and it didn’t work.
Could you please post the complete error message including the path to the file and line number where the error appears?
Hi, that’s actually the full message I get. Here’s a screenshot:
If I turn on debug, I get the exactly same thing. Is there any other way i can make my problem more replicable?
Could you try to remove the Panel and Kirby folders again und replace with new ones? How did you update?
Did it and nothings changed. I updated replacings index.php, panel and kirby folders.
Does it disappear when you go back to 2.3.2 (or whatever version you updated from)?
If i revert to 2.3.2 the panel loads but I also get a warning, more explicit than before:
Warning: file_exists() expects parameter 1 to be a valid path, string given in /Users/w4nderlust/Documents/Lavoro/Sito Web/w4nderlust/kirby/toolkit/vendors/yaml/yaml.php on line 542
I was revising the blueprint for that page, and I use the selector field:
Maybe the problem has to do with it, will try to see if there’s an updated version of it.
Edit: I checked and I have the latest one.
Got this hackety hack to work in kirby 2.3.2:
I changed line 542 of of yaml.php to:
if (!empty($input) && strpos($input, “\n”) === false && file_exists(strval(str_replace("\0", “”, $input))))
And the errors are gone.
If I put back 2.4.1 obviusly the error is back.
Well, instead you should probably verify that there are no null bytes in the blueprint and in its file name. The most reliable way to do this is to delete the blueprint and retype it.
@lukasbestle What would interest me is how these null bytes get there in the first place through uploading or whatever process?
Yeah, I thought about that as well. I have no idea.
Sure Lukas, the trick was there just to demonstrate that null characters are the issue.
Anyway my process is coding on my mac and uploading with cyberduck. I never purposedly uploaded files with null character in them and I have no idea of how they could have been added.
This evening I will try removing them somehow and let you know if it solves the problem. But are you sure it’s about the blueprint? I find more plausible that it has to do with uploaded file names, as the original pdfs uploaded for those pages contaned characters like :, ", '. So maybe kirby’s sanitizer substitutes them with null chars somehow? Or maybe it did it in previous versions, as I started working on that a long time ago (may 2015)
- the hack works in 2.4.1 too
- I tried renaming the blueprint, editing it’s content to remove the nuls with unix command tr and also to create a new file and retyping it completely. Nothing changed
- if I set debug = true at site level, when I get into pages with that blueprint (publication.php) I get the problem on the left panel that I showed you, but I discovered that if I try to create a new publication page, I get the full error report. I’m attatching it here for you to see
If you want to investigate further I can zip my full website and send it to you, it’s about 40mb so it’s not too big.
Could you please do that?
Sorry for the delay. Sent the zip as a private message.
After all, it was probably some issue with null bytes, we will never know.