Development

#814 (sfPHPView::configure() uses sfView::GLOBAL_PARTIAL in preg_match() call, so can't use "Global" at end of partial template name)

You must first sign up to be able to contribute.

Ticket #814 (closed defect: fixed)

Opened 4 years ago

Last modified 2 years ago

sfPHPView::configure() uses sfView::GLOBAL_PARTIAL in preg_match() call, so can't use "Global" at end of partial template name

Reported by: rjlyders Assigned to:
Priority: minor Milestone: 1.0.0
Component: askeet Version: 0.7.X
Keywords: sfPHPView preg_match GlobalPartial partial template Cc:
Qualification: Unreviewed

Description

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

Change History

08/29/06 15:49:05 changed by fabien

  • milestone set to 1.0.0.

08/29/06 15:49:30 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [1853]) added the action to the parameters of the view (closes #814)

04/09/08 11:25:16 changed by arunet

  • component set to askeet.
  • qualification set to Unreviewed.

sfRenderException]

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.