File_put_contents adding data twice in single instance

Bug Summary

In a themes functions.php file.
I am running the following code to debug:
‘time’ => time(),
‘user’ => get_current_user_id()
],true), FILE_APPEND); die;

And it’s adding the data twice

Steps to reproduce

Use the provided code

	'time' => time(),
	'user' => get_current_user_id()
],true), FILE_APPEND); die;

Environment Info

Describe your environment.

  • What Operating System are you using? Mac OS Sonoma14.1.2 (23B92)
  • What versions of site software (Nginx, Apache, PHP, MySQL) is used? Apache, Php 7.4.30, Mysql 5.7.28
  • What version of Local is installed? Version 8.1.0+6514

Supporting info

Please provide your Local Log. See this Community Forum post for instructions on how to do so:

Include any screenshots or video recordings of the issue to help others reproduce.

Hello @digamber -

Thank you for your question. Can you explain what you are trying to debug? That context might be helpful.

Also, where in the functions.php file are you adding this? If it’s in a loop of some kind that might explain why it is appending the data twice. I’d suggest adding it to the bottom of this file.

Let me know!


Hi @sambrockway

The code isn’t being used in any loops. I was using it to debug something else and found this unusual anomaly. The code is being added at the very end of the functions.php file in the theme.
I added it there just to verify this particular issue. I also asked a couple of my colleagues to verify this and I was able to recreate this issue on all windows and mac laptops.
The linux systems did not have this problem.

I hope this helps.

Hi @digamber -

Interesting!! I was looking at your specs…have you happened to try this with nginx and experienced the same results?


@sambrockway no i haven’t tried this with nginx, all systems i’ve tested this on is also apache server.