Very strange code behavior

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

I'm just not getting what the heck is causing this problem on a program I am writing. Here is the code in the php file:

<?php
<!-- TEST CODE START -->&lt;script language=\"JavaScript\" src=\"editor.js\"&gt;&lt;/script&gt;<!-- TEST CODE END -->
?>

and here is what is given when I do View Source:

<!-- TEST CODE START -->
&lt;script language="JavaScript"&gt;
<!--

function SymError()
{
  return true;
}

window.onerror = SymError;

//-->
&lt;/script&gt;

&lt;script language="JavaScript" src="editor.js"&gt;&lt;/script&gt;<!-- TEST CODE END -->
'

(Note, the comments were added to track down where in the program it was getting sending out the extra code) Now, I even changed it from calling a .js file to simply being

<?php
<!-- TEST CODE START -->&lt;script language=\"JavaScript\" type=\"text/JavaScript\"&gt;alert(\"Hello\");&lt;/script&gt;<!-- TEST CODE END -->
?>

Well I get the alert that pops up, but the source code STILL shows:
<!-- TEST CODE START -->
&lt;script language="JavaScript"&gt;
<!--

function SymError()
{
  return true;
}

window.onerror = SymError;

//-->
&lt;/script&gt;

&lt;script language="JavaScript" type="text/JavaScript"&gt;alert("Hello");&lt;/script&gt;<!-- TEST CODE END -->
'

Ok, I just did a search for "SymError" in ALL files on the program. No matches!

So now, I change the code to be:

<?php
<!-- TEST CODE START --><!-- script language=\"JavaScript\" type=\"text/JavaScript\" -->alert(\"Hello\");<!-- /script-- ><!-- TEST CODE END -->
?>

and the view source comes up (as I expect it to) <!-- TEST CODE START --><!-- script language="JavaScript" type="text/JavaScript" -->alert("Hello");<!-- /script-- ><!-- TEST CODE END -->'

Lastly, I tried changing the code to be the following:

<?php

  $jsOut
= \"&lt;script language=\\"JavaScript\\" type=\\"text/JavaScript\\"&gt;alert(\\"Hello\\");&lt;/script&gt;\";
  if (
$GLOBALS[\"debug\"]) debugOut(__FILE__,__LINE__,$jsOut);

<!-- TEST CODE START -->=
$jsOut <!-- TEST CODE END -->
?>

The if ($GLOBALS["debug"])... line dumps to a debug file, and in there it shows $jsOut to match what is is set for. However, once again, the source for the page, it still shows all the extra source code?!?!?!?

Am I missing something here? I'll try to post a copy on my personal page (uses the same server configurations)and provide i link to it here. I'm just plain stumped!

Thanks in advance for your help.

-Greg

PS. I was thinking, that maybe, somehow, the editor I was using was screwing up, and had code it wasn't showing. (had this happen with a editor I once used on Linux). However, I just went on the server and looked at the file directly there, and there is nothing different than what my editor here shows.

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Ok, I was going to delete this post, but figured I'd leave it up in case anyone else every comes across it.

It appears that this code is something that Norton Anti-Virus is automatically inserting into any page I view that has javascript. So if you have Norton running, and you are testing javascript, and it doesn't appear to be working, yet the browser isn't reporting an error, well this may be why. Looks like the code is there to supress errors??

Now I have to go find where to change that setting. I already had to go figure out how to get it to stop blocking my browsers from giving out the refering page to servers (they also say in help this prevents websites from knowing your e-mail address????)

Ok, My rant is done, I'm going for a beer.

-Greg

PS. I finally found a topic about this on norton's site. I have version 2003, and searching for help for that product returned no results. It is only listed for version 2004.

Anyhow, according to their site, this is part of their Ad Blocking feature, to get it to quit instering this into web pages, you need to shut off ad blocking. Hmmm. Ad Blocking is already completely shut off on my system....

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.