I've been developing a site using Wildflower CMS developed using CakePHP and ran into an infuriating problem. After working on it for several weeks without issue I started receiving javascript errors that caused everything to come to a grinding halt. The errors were all reported using Firebug and the javascript debugger. The culprit:
Unterminated String Literal
After that in the Firebug console was:
$ is not defined
I knew there was a strong possibility that the first error was somehow causing the second and that top-down debugging was the way to go. After inspecting the javascript code I discovered that there was a variable assignment going on that spanned several lines. This might be legal in PHP but not javascript. For example:
NO GOOD.
So what was causing this? Why wasn't Wildflower's JLM packager stripping newlines out? After some digging I found the method that was supposed to be doing just that and noticed it was only removing new lines, not carriage returns.
The Fix
/wildflower/controllers/components/jlm_packager.php
As you can tell, I just added carriage returns to the list of characters to be removed or altered (in this case removed). Initially this was never a problem. Only after I copied files down from a unix server to my windows machine did this start to occur. Hopefully this saves someone else some time.



Comments
klevo on (3.24.2009 8:36 am) says
klevo on (3.24.2009 8:41 am) says
Mike Bernat on (3.30.2009 12:17 am) says
Etienne on (6.19.2009 7:31 am) says