After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 607305 - Support PHP heredoc syntax
Support PHP heredoc syntax
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: general
1.7.5.1
Other Linux
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
Depends on:
Blocks:
 
 
Reported: 2010-01-18 14:17 UTC by Brent Smith
Modified: 2011-12-03 18:23 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Brent Smith 2010-01-18 14:17:27 UTC
Use of the PHP heredoc syntax can result in functions not being recognised and variables internal to functions being documented. Output of JavaScript code within a heredoc block is particularly problematic as the curly brackets seem to be interpreted as end-of-function marker.
Comment 1 Tim Brownlaw 2011-09-18 03:27:39 UTC
Doxygen version 1.7.5.1

From my experiements it's obvious that Doxygen is processing the contents within the heredoc.

Guaranteed Breaker:
<<<FRED
@<a[\s]+[^>]*?href[\s]?=[\s\""\']+(.*?)[\""\']+.*?>([^<]+|.*?)?<\/a>@
FRED;

It all comes down to the parsing of the quotes causing an error and doxygen stops processing the file.

Things to replicate the behaviour.
==================================
- the following two examples WILL Break doxygen
-----------------------------------------------

// single double quote
<<<FRED
"
FRED;
// and
// a single single quote
<<<FRED
'
FRED;

- the following two examples WORK
-----------------------------------
// two happy double quotes
<<<FRED
""
FRED;
// and
// two happy single quotes
<<<FRED
''
FRED;


If Doxygen does not see a pair of single or double quotes inside the heredoc, it fails the parser.

Suggestion:
===========

Do not Parse any content inside a heredoc statement.
In the Case of certain regex as I have used, it can break it.
Comment 2 Kevin McBride 2011-09-19 02:21:32 UTC
Changing version field based on text information of the bug.
Comment 3 Tim Brownlaw 2011-09-25 06:30:08 UTC
A workaround in this case is to use the commands htmlonly and endhtmlonly

So wrapping my piece of offending code like this...

/**
@htmlonly
*/
$pat = <<<FRED
@<a[\s]+[^>]*?href[\s]?=[\s\""\']+(.*?)[\""\']+.*?>([^<]+|.*?)?<\/a>@
FRED;
/**
@endhtmlonly
*/

Makes doxygen happy.

These are obviously not the correct commands but it they have the desired affect of ignoring what is encapsulated.

If there is ( and I would expect ) a command set to perform the same action, I'd love to know.

So Doxygen has the ability to ignore code, it'd just have to have a lot of extra parsing for these "exceptions" to trigger it.

I'm happy to use this workaround.

Cheers
Comment 4 Dimitri van Heesch 2011-10-13 18:47:26 UTC
Confirmed. I'll add heredoc and nowdoc support in the next subversion update.
Comment 5 Dimitri van Heesch 2011-12-03 18:23:02 UTC
This bug was previously marked ASSIGNED, which means it should be fixed in
doxygen version 1.7.6. Please verify if this is indeed the case. Reopen the
bug if you think it is not fixed and please include any additional information
that you think can be relevant.