what the actual fuck is PHP?
Aug. 1st, 2021 10:05 pmETA: THINGS GOT WORSE, then better. To wit: it wasn't PHP causing the problem per se, it was apache running the script silently again but with all parameters scrapped, all output suppressed, and all variables set to "null" somehow. BUT FILE WRITES STILL WORKED THANKS FOR THAT so it was writing the correct thing once, then immediately writing it over with the bullshit.
Fortunately, I understand reentrancy, and can detect it but WHAT THE FUCK APACHE WHY?!
(end ETA, original post below)
What the actual fuck is PHP?
I read some JSON. I decode the JSON. I change one value. I encode the JSON. I write the JSON to the screen. It is correct. I write the JSON to a file. It changes all of the contents to the word "null." Since it's a string, I prepend characters in front and append tot he end. It changes only the JSON part to the word "null."
Even if I do not change the JSON, if I just encode and decode it, it does the same thing.
What the actual fuck is PHP?
----- debug output -----
Fortunately, I understand reentrancy, and can detect it but WHAT THE FUCK APACHE WHY?!
(end ETA, original post below)
What the actual fuck is PHP?
I read some JSON. I decode the JSON. I change one value. I encode the JSON. I write the JSON to the screen. It is correct. I write the JSON to a file. It changes all of the contents to the word "null." Since it's a string, I prepend characters in front and append tot he end. It changes only the JSON part to the word "null."
Even if I do not change the JSON, if I just encode and decode it, it does the same thing.
What the actual fuck is PHP?
----- debug output -----
What we got {"season":"summer","east":"closed","west main":"closed","west up":"closed","north":"closed"}
Cleaned up {"season":"summer","east":"closed","west main":"closed","west up":"closed","north":"closed"}
Currently north is closed
Setting north to open
It is now open <--- this is just printing the value
json now encodes to {"season":"summer","east":"closed","west main":"closed","west up":"closed","north":"open"}
and was put into string as {"season":"summer","east":"closed","west main":"closed","west up":"closed","north":"open"}
and now that string is [LOL]{"season":"summer","east":"closed","west main":"closed","west up":"closed","north":"open"}[LOL]
-----
and here is that string written to a file:
[LOL]null[LOL]