Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

WallyJ's avatar

Error on line that has been edited/fixed

I have a particular project that I work on where I make edits live on the server... I know... let the flaming begin. Without going into particulars, for this project, it has to be this way.

So, sometimes I edit a file, refresh, and it works fine. Other times, like today, I will edit a line, and make a mistake, and as expected, I receive an error on the screen, but when I make the change to fix it, I still get the error, but the line is different, no longer containing the function that could even cause the error.

For instance,

I wrote this line of code as part of a query to restrict records by date:

->whereBetween('renewaldate', [$fromdate, $todate])

It worked just fine. But then I wanted to change the query to actually look for a particular date, instead of a range, so I hastily changed the code to this:

->whereBetween('renewaldate', "2020/08/31")

Which of course produced this error:

Argument 2 passed to Illuminate\Database\Query\Builder::whereBetween() must be of the type array, string given, called in...

Which makes sense because I didn't change the function to "where" rather than "whereBetween", as "whereBetween" requires two dates.

So I made the change to:

->where('renewaldate', "2020/08/31")

Saved the file and refreshed.

Same error. Wait, what? So I clicked on "Application Frames" under the error to see my line of code on the right section of the browser that is causing the problem.

It's the new line. The line highlighted is this:

->where('renewaldate', "2020/08/31")

A "whereBetween" error on a line that no longer says "whereBetween".

The weird part is that if I wait a few minutes and refresh again, the query works fine with no "whereBetween" error.

I thought it was my hosts' caching, and they suggested it had something to do with nginx, but I'm befuddled. This happens regularly. Is this a hosting thing, a Laravel thing?

Any ideas?

0 likes
8 replies
automica's avatar

@wallyj how are you editing the file? I guess you're logged in via an app rather than using ssh, because if you had that you'd be able to do your fixes locally and push them up?

WallyJ's avatar

Unfortunately, for this account I login through CPanel and use the File Manager there. But that does mean that the changes should be immediate.

automica's avatar

@wallyj I've not experienced any delays in cpanel either so seems a bit odd.

I'm using shared hosting with many of my sites and have set up a variety of lightweight deployment processes with both deployhq.com and also using bitbucket pipelines. That allows me to 'push up to deploy' using my repo and also a deploy can be triggered by editing the files in bitbucket and deploying from there.

I've got burned enough times editing files directly on a server to want to do without my version control

jlrdw's avatar

Sounds like a browser cache thing. Ctl-shift-del, clear, refresh. Doesn't hurt to reload page from scratch also.

Snapey's avatar

If these are view files, clear the view cache.

Your host could be caching the content somehow.

1 like
WallyJ's avatar

That's a good point @snapey . There is a Cache Manager function in CPanel, and I turned it off, and it has a "Purge" function, which I use to try and help, but it sometimes works and sometimes doesn't. :(

automica's avatar

@wallyj can you enable terminal and edit the files in a text editor that way? That would solve any cache issue.

Please or to participate in this conversation.