what the actual fuck is PHP?
Aug. 1st, 2021 10:05 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
ETA: 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]
no subject
Date: 2021-08-02 08:05 pm (UTC)no subject
Date: 2021-08-02 08:18 pm (UTC)no subject
Date: 2021-08-03 03:57 am (UTC)no subject
Date: 2021-08-03 07:20 am (UTC)So I said OKAY KNOW WHAT I'M GONNA OPEN THE FILE AGAIN FOR EVERY CHARACTER AND I'M GONNA DO IT APPEND SO I GET THE WHOLE STRING and when I did that it wrote:
[LOL]{"season":"summer","east":"closed","west main":"closed","west up":"closed","north":"open"}[LOL][LOL]null[LOL]
...and that's what set me on the path to finding it.