|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-12-17 23:26 UTC] rasmus@php.net
-Status: Open
+Status: Not a bug
[2013-12-17 23:26 UTC] rasmus@php.net
[2013-12-17 23:36 UTC] danielslcosta at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 08 02:00:01 2026 UTC |
Description: ------------ To prevent some editors showing errors in Javascript code with PHP code inside it, I comment the lines with PHP code. When you run the code, the alert and </script> goes one line up, and become commented. It seems it's "eating" the Line Feeds. Tested with LF and CRLF, both in Windows 7/PHP 5.5.7 TS and CentOS 6.4 with PHP 5.5.5. If you put a space or any other character after the closing tag ?> it works. Test script: --------------- <script type='text/javascript'> //<?php if (1) { ?> alert('test'); //<?php } ?> </script> <script type='text/javascript'> //<?php if (1) { ?>/ alert('test'); //<?php } ?>/ </script> Expected result: ---------------- The JS alert box should pop and the resulting HTML should be: <script type='text/javascript'> // alert('test'); // </script> <script type='text/javascript'> /// alert('test'); /// </script> Actual result: -------------- The 'alert' and '</script>' are commented <script type='text/javascript'> // alert('test'); //</script> <script type='text/javascript'> /// alert('test'); /// </script>