Version: 0.7.1587
File: sfPHPView.class.php
Function: configure()
Problem: Use of sfView::GLOBAL_PARTIAL in call to preg_match() restricts use of "Global" at end of a non-global template name.
NOTE: This might be just considered a "feature" rather than a bug and may just need to be identified in the documentation if not already done, but this issue was introduced in 0.7.1587 as it is not a problem when using 0.6.3.
Because sfPHPView::configure() uses sfView::GLOBAL_PARTIAL ("GlobalPartial?") in it's call to preg_match() to split up the partial template's view name, developers can't use "Global" at end of *non-global* partial template name.
For instance, we have a module partial template named "_ticketGlobal.php" in the "ticket" module that contains a function that is included by several other PHP scripts via "include_partial('ticket/ticketGlobal')". But this results in the following sfRenderException:
The template "D:\ws\voilaip\apps\sales\modules/ticket/templates/_ticket.php" does not exist or is unreadable
This occurs because the call to preg_match tries to split up the "_ticketGlobalPartial" using "GlobalPartial?" when it intended on splitting up "Partial" from the template name of "_ticketGlobal". Thus the "Global" at the end of the partial template name confused preg_match() when it used the "GlobalPartial?" as the condition in the regular expression.
To resolve my source, I will simply rename the _ticketGlobal.php file to _ticketGlobalCommon.php fix the problem. I have already proven that this does fix the problem in my source.
In summary, this issue might already be documented, that I am not aware of, as a restriction on the naming of partial templates, but if not, then at least it would be helpful to have this identified in the documentation as a restriction on the naming of partial templates.
Even better, it would be ideal if the sfPHPView class picked up on this problem and identified the problem for the developer stating something like: "invalid template name: you can not use the word Global in a partial template name."
Thanks for your thoughts on this.
-Rich