Trac not displaying php source files (sometimes)


#1

Hi there,

I’m using trac from 1-click installs.

I recently noticed that (in the source code browser) sometimes my PHP source files display OK, and sometimes they say “HTML preview not available”.

I enabled debug logging and noticed that it sometimes invoke PHPRenderer and sometimes it doesn’t.

Example:
http://semap.baby.com.ar/browser/txp/plugins/trunk/ort_rss2article/ort_rss2article.php?rev=861 displays OK.

Here’s the log output for it:

2010-12-16 10:56:53,253 Trac[main] DEBUG: Dispatching <Request "GET u'/browser/txp/plugins/trunk/ort_rss2article/ort_rss2article.php'">
2010-12-16 10:56:53,257 Trac[chrome] DEBUG: Prepare chrome data for request
2010-12-16 10:56:53,259 Trac[perm] DEBUG: No policy allowed anonymous performing TICKET_CREATE on None
2010-12-16 10:56:53,259 Trac[perm] DEBUG: No policy allowed anonymous performing TRAC_ADMIN on None
2010-12-16 10:56:53,259 Trac[perm] DEBUG: No policy allowed anonymous performing PERMISSION_GRANT on None
2010-12-16 10:56:53,260 Trac[perm] DEBUG: No policy allowed anonymous performing PERMISSION_REVOKE on None
2010-12-16 10:56:53,260 Trac[perm] DEBUG: No policy allowed anonymous performing TICKET_ADMIN on None
2010-12-16 10:56:53,263 Trac[browser] DEBUG: Rendering preview of node ort_rss2article.php@861 with mime-type text/x-php; charset=utf-8
2010-12-16 10:56:53,263 Trac[api] DEBUG: Trying to render HTML preview using PHPRenderer [lineno]
2010-12-16 10:56:53,263 Trac[php] DEBUG: PHP command line: /usr/local/bin/php -sn
2010-12-16 10:56:53,325 Trac[perm] DEBUG: No policy allowed anonymous performing EMAIL_VIEW on None
2010-12-16 10:56:53,326 Trac[session] DEBUG: Retrieving session for ID '5714cef0cfdb60ecb131908a'
2010-12-16 10:56:53,433 Trac[main] DEBUG: 4650 unreachable objects found.

However, if I try to see a later version of the same file: http://semap.baby.com.ar/browser/txp/plugins/trunk/ort_rss2article/ort_rss2article.php?rev=899 it displays the HTML preview not available message.

Here’s the logging for this:

2010-12-16 10:58:55,709 Trac[main] DEBUG: Dispatching <Request "GET u'/browser/txp/plugins/trunk/ort_rss2article/ort_rss2article.php'">
2010-12-16 10:58:55,713 Trac[chrome] DEBUG: Prepare chrome data for request
2010-12-16 10:58:55,715 Trac[perm] DEBUG: No policy allowed anonymous performing TICKET_CREATE on None
2010-12-16 10:58:55,715 Trac[perm] DEBUG: No policy allowed anonymous performing TRAC_ADMIN on None
2010-12-16 10:58:55,716 Trac[perm] DEBUG: No policy allowed anonymous performing PERMISSION_GRANT on None
2010-12-16 10:58:55,716 Trac[perm] DEBUG: No policy allowed anonymous performing PERMISSION_REVOKE on None
2010-12-16 10:58:55,716 Trac[perm] DEBUG: No policy allowed anonymous performing TICKET_ADMIN on None
2010-12-16 10:58:55,719 Trac[browser] DEBUG: Rendering preview of node ort_rss2article.php@899 with mime-type text/x-php; charset=utf-8
2010-12-16 10:58:55,721 Trac[perm] DEBUG: No policy allowed anonymous performing EMAIL_VIEW on None
2010-12-16 10:58:55,722 Trac[session] DEBUG: Retrieving session for ID '5714cef0cfdb60ecb131908a'
2010-12-16 10:58:55,768 Trac[main] DEBUG: 507 unreachable objects found.

Notice that, in the latter case, the following lines are not present:

DEBUG: Trying to render HTML preview using PHPRenderer [lineno]
Trac[php] DEBUG: PHP command line: /usr/local/bin/php -sn

I googled the problem, but can’t find anything about it… it doesn’t seem the same problem as http://trac.edgewall.org/ticket/3886