This is a quick guide on how to fix the following PHP warning:
Warning: Unterminated comment starting line 5 in /path/to/file.php on line 5
The PHP warning above will occur if you fail to close a multi-line comment.
In PHP, a multi-line comment looks like this:
/** * This is a multi-line comment. * This is the second line. * And other line. */
Multi-line comments must be “closed off” by using an asterisk and a forward slash (*/). Take the following example, which will reproduce this error:
echo 'Hello world!'; /* * This is a comment that hasn't been closed off.
In the PHP snippet above, I failed to close off my comment. As a result, PHP will throw an “Unterminated comment” warning.
From my own personal experience, this kind of warning is thrown when a developer attempts to “comment out” large blocks of code while debugging an issue.
To fix this warning, you will need to track down the offending comment and make sure that it has been closed off properly.