I run a local server I am working on and php echo appears to be freaking out. This is the error:
echo "<script>console.log('test');</script>";
yields
<script>console.log('test');</script>;0')</script>
when I "view page source" of the webpage. In the page itself, this shows up as just 0');
and the console.log()
appears to be working just fine. If I change one of these to remove all javascript and just do something like
echo "testing";
what shows up is:
testing0');</script>
when I write a new echo it works fine, when I have tried making new pages, they also work fine, when I view it in safari (I regularly use chrome) this problem persists. This problem occurs each time I echo a script, but when echoing something else it behaves normally. Only if I change an existing echo to plain text does it still append the ;0')</script>
, when I write a new echo that writes a script it works just fine.
If I add die();
after any echo statements, that one (and that one only) lacks the ;0')</script>
all those above it still have it at the end.
What the heck did I do to cause this?
info: I am using the default apache install on mac and php version 5.5.36. Feel free to ask me clarifying questions and if need be I can post the full php file on github.
Thanks in advance,
Lewis
Edited for clarity.