[Resolved] [Plugin: Crayon Syntax Highlighter] Problem with copied code from Chrome
I’m thinking this may be a chrome bug since it doesn’t happen in any other browser but I’m not 100% sure. When I copy the raw code from a crayon snippet in Chrome and paste it into a file, it seems to copy some bad characters. It appears to be the spaces that get corrupted. When I copy perfectly valid code and save it to a PHP file and try to run it, I get an error message similar to the following:
PHP Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION…
I have tried this with two different editors (PhpEd and Notepad++) and both have the same result.
Here are the steps to reproduce the error:
1. Copy the (plain text) code from the ‘Other Methods’ section of this page: http://www.hoffsays.com/2012/06/12/custom-404-not-found-error-pages-in-cakephp-2-0/
2. Paste it into an editor wrapped in <?php ?> tags.
3. Remove “App::uses(‘ExceptionRenderer’, ‘Error’);” and ” extends ExceptionRenderer” and save the php file.
4. Try to run the file on your local server and you’ll get the error.
I did a little digging with Firefox and Firebug and I think it’s related to the entities that are in the textarea. Should these be actual spaces instead of in the textarea?
Again, this might be a Chrome bug but I know you could fix the issue a helluva lot faster than it would ever get fixed in Chrome.
- The topic ‘[Resolved] [Plugin: Crayon Syntax Highlighter] Problem with copied code from Chrome’ is closed to new replies.